This article describes how to adjust the checkbox in jQuery1.9.1. Use prop to replace the version of attr in jquery 1.8.x. The following operations are performed to select and unselect the checkbox:
Check whether selected
The Code is as follows:
$ ('# Checkbox'). prop ('checked ')
Set the selected or unselected status:
The Code is as follows:
$ ('# Checkbox'). attr ('checked', true)
$ ('# Checkbox'). attr ('checked', false)
However, in jquery1.9.1, some operations are different.
In IE10, Chrome, FF, for the selected status, the first $ ('# checkbox'). attr ('checked', true) can be implemented
However, when you clear the selected items by using the code, you can use the code $ ('# checkbox'). attr ('checked', true) next time.
Although the Code contains checked = 'checked', the image performance is not checked.
This problem is not found in IE8 and IE6.
Later, I investigated the relevant information and found that attr ('checked', true) is now replaced with prop ('checked', true)