On the problem of checked attribute of jquery and checkbox _jquery

Source: Internet
Author: User

1, after the success of the page load, click to select or uncheck the Checkbox,checkbox property in the Checked property does not change according to whether the checkbox is selected

2, in the checkbox in the onchange or the OnClick method in the jquery attr method obtains the checked is to see the value of the checked attribute is not related to whether it is hooked

3, the use of document.getElementById ("checkbox_id"). Checked gets the value and whether it is hooked up to, that is, the WYSIWYG

4. Use $ ("#checkbox_id"). attr ("checked") gets the value and <input type= "checkbox" in the checked situation one to, is not the WYSIWYG

5. Use $ ("#checkbox: Checked") to get all the checkbox on the hook

6, document.getElementById ("checkbox_id"). Checked=true, the Checked property in the control is not displayed, what you see

7. $ ("#checkbox_id"). attr ("Checked", true), the checked property in the control is displayed, what you see, and the code changes

The above analysis of jquery and checkbox checked attributes of the problem is small series to share all the content of everyone, hope to give you a reference, but also hope that we support the cloud habitat community.

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.