The problem of the checked property of jquery and checkbox

Source: Internet
Author: User

1. After the page has been loaded successfully, click to select or uncheck the Checked property in the Checkbox,checkbox property will not change depending on whether the checkbox is selected or not

2, the checkbox in the onchange or OnClick method with the attr method of jquery to get checked is to see the value of the checked attribute and whether it is not related to the hook

3. Use document.getElementById ("checkbox_id"). Checked gets the value with whether the hook is up to, that is, the WYSIWYG

4. Use $ ("#checkbox_id"). attr ("checked") the value obtained with <input type= "checkbox" ></input> checked situation one to, not WYSIWYG

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

6, document.getElementById ("checkbox_id"). Checked=true, the checked attribute in the control is not displayed, what is seen

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

The problem of the checked property of jquery and checkbox

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.