Radio is used to achieve the user's selection effect, and some methods of using JQUERY to operate Radio are accumulated in the project, here, I will share with you the fact that Radio is often used in development to achieve user selection. I have accumulated some methods to operate Radio using JQUERY in the project. Here I will share with you, for your reference.
1. Change the choice of radio to trigger some results.
The Code is as follows:
$ ("Input: radio [name = 'dialcheckresult']"). change (function () {// dial alert ("123 ");});
2. Make all radio available on the page
$("input:radio").attr("disabled",false);
3. Make all radio on the page unavailable
$("input:radio").attr("disabled","disabled");
4. Place a radio in the selected status
$("input:radio[name='dialCheckResult']").eq(0).attr("checked",true);
5. Disable "unselected" radio on the page
$("input:radio:not([checked])").attr("disabled","disabled");
6. traverse the radio of the selected state. Except for one radio, the radio of other "selected" States is set to "unselected ".
The Code is as follows:
$('input:radio:checked').each(function(i,val){if(val.name != "dialCheckResult" ){$("input:radio[name='"+val.name+"']:checked").attr('checked',false);}});
7. Make radio unavailable in all "unselected" states
$("input:radio:not([checked])").attr("disabled","disabled");
8. Obtain the radio value of a specific NAME.
var dialCheckResult=$("input:radio[name='dialCheckResult']:checked").val() ;
9. Place radio in the "unselected" status
$('input:radio:checked').attr('checked',false);
10. Place radio on the page in the "selected" or "unselected" status.
$("input:radio").attr("checked",true);$("input:radio").attr("checked",false);