About check boxes and radio boxes

Source: Internet
Author: User

Many times I would like to use the browser default radio button or check box, such as lazy or bad mood when ╮ (╯﹏╰) ╭,

In the HTML structure I would like to implement the radio button next to the text clicked and then select or vice versa, like this:

The HTML code can be written like this: <label><input type= "Radio"/>JAVASCRIPT</LABEL> the event is automatically associated with a label tag.

Then the question came, if it is more than one option, I would like to click on an option, the other is not selected by default, how to write, copy the above code paste a few lines changed the text on the line, if I do not write the following code, haha:

    <label><inputtype= "Radio"name= "Options" />Javascript</label>    <label><inputtype= "Radio"name= "Options" />Html5</label>    <label><inputtype= "Radio"name= "Options" />Css3</label>

I need to associate them with the name attribute so that I can achieve the desired effect:

  $ (' input[type=checkbox] '). Prop (' checked ') //< /span> get  $ (' input[type=checkbox] '). Prop (' checked ',    true ) //  set  $ (' input[type=checkbox] '). Prop (' checked ',  False ) //  set  //  alert (Document.queryselector (' input[type=checkbox] ' Span style= "color: #000000;"    >). checked); Document.queryselector ( ' input[type=checkbox] '). Checked=true  ; Document.queryselector ( ' input[type=checkbox] '). Checked=false ;  

check box event:

Assuming that the check box on the page is selected, when clicking on a checkbox, is the first click event or the event that the checkbox turns true, it turns out that the browser defaults to the checkbox's checked to True, Then the click event of the checkbox is executed, so the ╭∩╮ (︶^︶) ╭∩╮ to write like this:

About check boxes and radio boxes

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.