0

I have a repeater with a checkbox in the item template. During itemdatabound event of the repeater I add an attribute to the checkbox

 ((CheckBox)e.Item.FindControl("chkPresents")).Attributes.Add("accountName", ((DataRowView)e.Item.DataItem)["accountName"].ToString());

I have a button that suppose to get all the checked checkbox and the account name associated with it.

How can I do this using jquery.

Thanks very much.

1
  • 2
    what exactly is the error here? Can you post the JQuery ode you wrote that is not doing what you expect? Commented Aug 11, 2011 at 10:16

2 Answers 2

3

You can do following things.

$(docuement).ready(function()
{
   $("#yourButtonID").live("click",function()
   {  
      $('input[id*="chkPresents"]:checked').each(function() // mathing all checked imputs

      {
         $(this).attr("accountName") ; //is your accountName
         $(this) //is reference to current  checkbox
       }
      )
   })
})
Sign up to request clarification or add additional context in comments.

Comments

0

This would alert the "accountName" attribute for all checked checkboxes -

$(document).ready(function()
{
    $("#clickbutton").click(function () {
        $("input:checkbox[checked]").each(function () {
         alert($(this).attr("accountName"));
        }    
       )    
    });    
});

http://jsfiddle.net/ipr101/bV96D/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.