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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -