Saturday, 17 August 2013

Check/uncheck all checkbox onclick th tag

Check/uncheck all checkbox onclick th tag

Hi Check/uncheck all function is working very good for me. Now my problem
is to same functionality have to be done with onclick table head
Code$('#chkall_head').click(function(event)
{
if($("#chkall").attr('checked') == true)
{
$(':checkbox').each(function()
{
this.checked = true;
});
}
else
{
$(':checkbox').each(function()
{
this.checked = false;
});
}
});
<tr>
<th id="chkall_head"><input type="checkbox" id="chkall"
name="chkall"></th>
<th>Check all</th>
</tr>
Please suggest some ideas to check/uncheck all checkbox onclick th and
checkbox also

No comments:

Post a Comment