Questions about whether or not a checkbox is selected in a JSP page

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.