A simple example of jquery operation Radio

Source: Internet
Author: User

  This article mainly introduces a simple example of jquery operation Radio. Need friends can come to the reference, I hope to help you.

<input name= "study" type= "Radio" value= "jquery plugin tutorial" >jquery plugin tutorial <input name= "study" type= "Radio" value= " jquery Learning ">jquery Learning <input name=" study type= "Radio" value= "PHP Learning" >php learning <input id= "Tijiao" type= "button" Value= "OK" > <input id= "set_jqeury_study" title= "jquery Learning" type= "button" value= "Set Radio as jquery learning" > < Input name= "study" type= "text" value= "Please enter the knowledge you want to learn" > <input id= "view_input_text" type= "button" value= "click Me, Look for the same name as ' study ', but the type is text in the input box inside the value ">   in the above HTML code, careful you should be able to find 3 Radio Name property and a text of the Name property are" study "        Code is as follows: $ (function () {$ (' #tijiao '). Click (function () {if ($ ("input:[name=study]:radio:checked"). Length = = 0) {alert ("Please select the knowledge you want to learn"); return false;} var study = $ ("input:[name=study]:radio:checked"). Val (); Alert ("Thank you!") You selected is "+ study"; $ ("#set_jqeury_study"). Click (function () {var $button = $ (this); $ (' Input:[name=study]:radio '). each (function () {if ( This.value = = $button. attr (' title ')) {this.checked=true}}) }) $("#View_input_text "). Click (function () {Alert ($ (" Input[name=study]:text "). Val ())})   $ ("input:[name=study]:radio:checked") This code gets all of the jquery objects with the Name property "study" and has been selected, by determining whether his length equals 0, You can tell if one of the radio options is selected. $ ("Input[name=study]:text") This code gets the jquery object for the text input box with the Name property "study".

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.