In the jquery 1.8.x version, our check and uncheck actions for the checkbox are as follows:
Decide whether to select
$ (' #checkbox '). Prop (' checked ')
Set checked and unchecked states:
$ (' #checkbox '). attr (' checked ', true)
$ (' #checkbox '). attr (' checked ', false)
However, this method does not work the same in jquery1.9.1 or later
Ie10,chrome,ff, for the selected state, the first $ (' #checkbox '). attr (' checked ', true) can be implemented
But when cleared by code, the next time you pass the code $ (' #checkbox '). attr (' checked ', true) to select
Although the code has checked= ' checked ', but the screen performance is not ticked.
IE8,IE6 does not have this problem.
Later investigation of the relevant information, found now attr (' checked ', true) are replaced by prop (' checked ', true)
This is normal, the original use of attr is not, I use is: 1.8 and 2.0
if(splitstr[5] =="male") { $("#man"). Prop ("checked",true); } Else if(splitstr[5] =="female") { $("#woman"). Prop ("checked",true); }
"Forward" jQuery1.9.1 to the highest version for checkbox adjustment