This article mainly introduces the jquery operation checkbox to achieve full selection and cancel full selection. You can refer to the following example to write a function for all selection and cancellation:
Select All: $ (": checkbox"). attr ("checked", "checked ");
Deselect all: $ (": checkbox"). removeAttr ("checked ");
Get the selected: $ (": checked [checked = 'checked']")
You can select all vertices. You can cancel all the selected vertices. If you fail to obtain the selected vertices, clicking any button will no longer work.
This won't work, and I don't know what the cause is. This is the case with the scripting language. I am not going to find the reason while being flexible. Later I wrote it like this.
Select All: $ (": checkbox"). prop ("checked", true)
Deselect all: $ (": checkbox"). prop ("checked", false)
Get the selected: $ (": checkbox: checked ")
Invert selection:
The Code is as follows:
$ (": Checkbox"). each (function (){
If ($ (this). prop ("checked ")){
$ (This). prop ("checked", false );
} Else {
$ (This). prop ("checked", true );
}
});