JS get radio of those things

Source: Internet
Author: User

"Grammatical Structure"
$ ("input#id.class[name=myname][type=radio][checked]"). Val ();
$ (' input#id.class[name=myname]:radio:checked '). Val ();

"Gets the value of the radio selected item"
$ (": Radio"). Click (function () {

$ (this). Val ();

});

"Set the second radio item as selected"

<input id= "Q1" class= "W1" name= "E1" value= "1" type= "Radio" checked>1</input>
<input id= "Q1" class= "W1" name= "E1" value= "one" type= "Radio" >11</input>


$ (' input#q1.w1[name= ' E1 "][type=radio]"). Get (1). checked = ' true ';//Can be alone true does not require "" or 1

Note

(1) name is a group of radio buttons, so selecting a different button will be a single selection.
(2) $ (: Radio) is wrong, must have "or"
(2) [Name=myname] in the myname may not need "" or ", if necessary, with the outer" or "" inconsistent, [Type=radio] the same

JS get radio of those things

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.