About some pits in the radio tag (new issues will continue to be updated)

Source: Internet
Author: User

About input, as a front-end do not know is unqualified, after all, no one project will not be missing this label, in fact, most of the input tag is good to say, but the biggest problem is radio, checkbox this choice tag.

About the use of Radio,checkbox, now many people have abandoned the original input radio and checkbox to choose Other plugins, undoubtedly this is a clever and easy way, but have to say that the greatest advantage of the original is flexible. So in some cases it will still be used.

<input type= ' Radio ' id= ' x ' name= ' x ' checked/>

Let's start with the question. When using the JQuery method to add the checked attribute to radio, there is no problem, but when the value of the Checked property is empty, there is a problem, the result radio is still selected state.

The problem is that when you add radio there will be a checked attribute, note that the checked attribute is the selected state, which does not require him to have any value when he is selected, so there is an error in using jquery to get the selected value.

The solution is also a concern when you need to use the code to control the selection, use the native checked property, or use the Add Delete attribute (not recommended), or choose the lazy dedicated jquery plugin

Well, if you encounter other problems in adding ....

This article is from the "Do Not Laugh" blog, please make sure to keep this source http://8779947.blog.51cto.com/8769947/1828703

About some pits in the radio tag (new issues will continue to be updated)

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.