Some browsers or jquery versions are different, which makes it impossible to get the selected elements;
prop (NAME|PROPERTIES|KEY,VALUE|FN) Gets the property value of the first element in the matching element set. With some built-in properties for DOM elements or window objects, the browser may produce an error if the property is attempted to be deleted. jquery assigns the properties of the undefined value for the first time, ignoring any errors generated by the browser jquery code: $ ("input[type= ' checkbox ']"). Prop ("checked"); parameter properties Description: Disables all check boxes on the page. jquery Code: $ ("input[type= ' checkbox ']"). Prop ({ disabled: true &NBSP, key,value Description: Disable and select the check box on all pages. jquery Code: $ ("input[type= ' checkbox ']"). Prop ("Disabled", false); $ ("Input[type= ' checkbox ']. Prop ("Checked", true); parameter key, callback function Description: The check box is selected by function to set all the pages. jquery Code: $ ("input[type= ' checkbox ']"). Prop ("Checked", function ( i, val ) { return !val; });
return value: Booleanis (EXPR|OBJ|ELE|FN) Overview The collection of matching elements is detected based on the selector, DOM element, or JQuery object, and returns true if at least one of the elements conforms to the given expression. Returns ' false ' if no element is met, or if the expression is not valid. "Note:" in jquery 1.3, all expressions are supported. In previous releases, a complex expression, such as a hierarchy selector (such as +, ~ and >), would always return true
$ (this). Prop (' checked ') $ (this). attr ("Checked") $ (this) [0].checked$ (This). Is (": Checked") These four methods are sure to meet your
Recommended choice. is or $ (this) [0].checked
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/48/wKiom1UEE9uAJy_UAAEvAdJXTPI356.jpg "title=" Che1.png "alt=" Wkiom1uee9uajy_uaaevadjxtpi356.jpg "/>
This article is from the "Romantic Dev" blog, so be sure to keep this source http://xinbaby88.blog.51cto.com/9943025/1620390
Questions about whether or not a checkbox is selected in a JSP page