Home > Article > Web Front-end > jQuery1.9.1 adjustment method for checkbox (prop)_jquery
In the version of jquery 1.8.x, our operations for selecting and unchecking the checkbox are as follows:
Determine whether to select
Set checked and unchecked status:
But this method is handled differently in jquery1.9.1
In IE10, Chrome, FF, for the selected state, $('#checkbox').attr('checked',true) can be achieved for the first time
But when the selection is cleared through code, the next time it is cleared through code $('#checkbox').attr('checked',true) When selecting
although there is checked='checked' in the code, there is no check in the screen performance.
This problem does not exist under IE8 and IE6.
Later I investigated the relevant information and found that now attr('checked',true) has been replaced by prop('checked',true)