I have code which displays a person's info in a table (fields:name, surname, address, etc.) and one of the inputs is a checkbox. The code is as follows:
$("#table").append('<tr class="trow'+j+'">'+
'<td class="ids" id="z'+i+'">'+totrecs+'</td>'+
'<td>'+member[i].jdate+'</td>'+
'<td class="users"
'<td id="contact'+i+'">'+member[i].fname+' '+member[i].lname+'</td>'+
'<td id="myaddress'+i+'">'+member[i].address1+' '+member[i].town+'</td>'+
'<td><input type="checkbox" name="whome" id="showMe'+i+'"'+
'class="boxes" onclick="getMe('+i+')" /> </td></tr>');
totrecs++;
j++;
}
button - <input type="button" id="selectall" title="Select All" value="Select All" />
What I am trying to do is create a function sot that when a certain button is clicked, all of the checkboxes will be selected/checked.
I would appreciate any help. Thank You.
从我的头顶上掉下来:
$('#table input[type="checkbox"]').prop('checked', true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.