Home >Web Front-end >JS Tutorial >Summary of how to operate Radio using jquery_jquery
Radio is often used in development to achieve user selection effects. I have accumulated some methods of using JQUERY to operate Radio in the project. I will share them here for friends in need to learn from.
1. Change the radio selection and trigger some effects
$("input:radio").attr("disabled",false);
3. Make all radios in the page unavailable.
$("input:radio").attr("disabled","disabled");
4. Make a radio selected.
$("input:radio[name='dialCheckResult']").eq(0).attr("checked",true);
5. Make the "unselected" radio in the page unavailable.
$("input:radio:not([checked])").attr("disabled","disabled");
6. Traverse the radios in the selected state. Except for one radio, the radio settings in the other "selected" states are in the "unselected" state.
$("input:radio:not([checked])").attr("disabled","disabled");
8. Get the radio value of a selected specific NAME.
var dialCheckResult=$("input:radio[name='dialCheckResult']:checked").val() ;
9. Put all radios in the "selected" state into the "unselected" state.
$('input:radio:checked').attr('checked',false);
10. Put all radios on the page into the "selected" or "unselected" state.
$("input:radio").attr("checked",true);
$("input:radio").attr("checked",false);