I have 10 checkboxes in my page, dynamically created by jquery.
Its starts like chk1 , chk2 and….so on.
I want to get which checkbox is checked out of 10 checkboxes .
for (i=0; i < tbl01.length; i++)
{
if ($("input[type=checkbox][checked]"))
{
var checked = chk+i;
}
}
where
tbl01
is my dataset to dynamically create my checkboxes
I have tried to some extent, is this correct ?
Use the :checked selector:
Also, if you’re just checking whether an element exists, you’ll want to check
.lengthon the returned selector (because jquery always returns an object, it just might not have anything in it):