Home >Web Front-end >JS Tutorial >Introduction to jquery traversing checkbox_jquery

Introduction to jquery traversing checkbox_jquery

WBOY
WBOYOriginal
2016-05-16 16:58:54948browse

checkbox Select all Cancel
$("#ChkAll").click(function(){
$("#divContent input[type=' checkbox']").attr("checked",$(this).attr("checked"));
});

Get the value of the selected checkbox:
var arrChk=$("input[name='chk_list'][checked]");
$ (arrChk).each(function(){
            window.alert(this.value);                                                                                             

$("#checkbox_id").attr("checked"); //Get the status of a CheckBox (whether it is selected, return true/false)

$("#checkbox_id").attr("checked",true); //Set the status of a CheckBox to checked (checked=true)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn