The content of this article is about how to implement all selection and none selection in phpcms background? (Attached code), it has certain reference value, friends in need can refer to it, I hope it will be helpful to you .
html code
1 2 3 4 5 6 7 | <th width= "5%" ><input value= "" id= "check_box" onclick= "selectallForAuditions('ids[]');" type= "checkbox" /></th>
<td align= "center" >
<input id= "course_<?php echo $r['id']; ?>" class = "inputcheckbox" onclick= "chooseCourse(<?php echo $r['id']; ?>)" name= "ids[]" value= "<?php echo $r['id']; ?>" type= "checkbox" >
</td>
|
Copy after login
jquery code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function selectallForAuditions(name) {
if ($( "#check_box" ).attr( "checked" )=='checked') {
$( "input[name='" +name+ "']" ).each( function () {
$( this ).prop( "checked" , "checked" );
chooseAllCourse($( this ).val());
});
} else {
$( "input[name='" +name+ "']" ).each( function () {
$( this ).removeAttr( "checked" );
});
}
}
function chooseAllCourse(courseId) {
var strKeyName = auditions + "_courseId_" + courseId;
localStorage.setItem(strKeyName, courseId);
getCourse();
}
|
Copy after login
Related recommendations:
phpcms always jumps to install/install after the installation is completed. php, phpcms installation
PHPCMS builds wap mobile website, phpcms builds wap
The above is the detailed content of How to achieve all selection and none selection in phpcms background? (Code attached). For more information, please follow other related articles on the PHP Chinese website!