I have 2 checkboxes inside an Updatepanel:
<asp:UpdatePanel>
<asp:CheckBox CssClass="checkboxDivE"/>
<asp:CheckBox CssClass="checkboxDivE"/>
<asp:UpdatePanel>
in js, jquery:
$('.checkboxDivE').live('click', function (e) {
alert($(this).is(':checked')); // always giving false result
});
markup:
<span class="checkboxDivE" title="Export a trip"><input id="ctl00_ContentPlaceHolder1_GridView_Trips_ctl02_checkboxDivE" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView_Trips$ctl02$checkboxDivE"></span>
<span class="checkboxDivE" title="Export a trip"><input id="ctl00_ContentPlaceHolder1_GridView_Trips_ctl03_checkboxDivE" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView_Trips$ctl03$checkboxDivE"></span>
Whenever I check or uncheck the checkbox, the result is always false?
I have spent hours for finding a solution but I could not! is it a problem with jquery inside an updatePanel?
If you look at your markup, you’ll notice that the ID of your checkbox is actually
ctl00_ContentPlaceHolder1_GridView_Trips_ctl03_CheckBoxExportTourand the class you are trying to grab –checkboxDivE– belongs to the span.You just need to change your selector.