I got this code from stackoverflow which looks like a pretty good \"select all\" checkbox solution, any ideas why it fails after 2nd click?
http://jsfiddle.net/R9zj
some problem is solved see the live demo at here
HTML code is:
select all
and Javascript is:
$(document).ready(function () {
$(document).on("click", ".selectall2", function () {
$(this).closest('tr').find('input[type=checkbox]').attr('checked', this.checked);
});
$(document).on("click",".abc",function(){
var temp=0;
if(!$(".abc").attr('checked'))
{
temp=1;
}
if(temp==0)
{
$(".selectall2").attr('checked',true);
}
else
{
$(".selectall2").attr('checked',false);
}
});
});