javascript - It's possibile select one radio without name attribute? -
i need use attribute name can use "name" attribute radio button. know code radio button exclusive choice is:
<input type="checkbox" name="radio"> <input type="checkbox" name="radio">
anyone can me choice method render radio exclusive choice without name attribute?
you use class
:-
$('.radio').change(function() { $('.radio').not(this).prop('checked', false); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="radio" class="radio"> <input type="radio" class="radio">
or type
:-
var radios = $('[type="radio"]'); radios.change(function() { radios.not(this).prop('checked', false); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="radio"> <input type="radio">
Comments
Post a Comment