Recently, using the jquery Operation checkbox in learning, use the following method to select all, reverse:
$ ("Input[name= ' checkbox ']"). attr ("Checked", "checked");
debugging, the first two are no problem, you can display the normal check and cancel, but when the check box to select the checkbox value changed to "checked", no problem, but the check box is not displayed in the selected state, the property value changed, but does not show the check, too weird. Code changes to not get the correct display state, tangled for a long time, can not find the reason.
So various reasons, and later found an article on the internet to remind me that the original is the jquery version of the problem.
I manipulate properties with the
$ ("XXX"). attr ("Attrname"), while the version of jquery is 2.1.4, there is a compatibility and stability issue.
The jquery API clearly illustrates that 1.6+ jquery uses prop, especially the checkbox's Checked property,
Use the following code:
$ ("Input[name= ' checkbox ']"). Prop ("checked");
$ ("Input[name= ' checkbox ']"). Prop ("disabled", false);
$ ("Input[name= ' checkbox ']"). Prop ("checked", true);
So the attr changed to prop, the problem is solved.
Solve the jquery operation checkbox Select all do not select the problem