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".