I need that when I click on the a
tag the radio will check. I did a function to do it and it does it well, the problem is that if I want to check another one that I had already checked, it does not do it anymore. I need the tags in that order and I can not do it.
Welcome to all suggestions
$(function(){
$(document).on('click','a',function(e){
e.stopPropagation();
e.preventDefault();
$(this).find('input[type="radio"]').attr('checked','checked');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<a href="#"><input type="radio" name="radio" value="0" checked>Opcion 1</a>
<a href="#"><input type="radio" name="radio" value="1" >Opcion 2</a>
<a href="#"><input type="radio" name="radio" value="2" >Opcion 3</a>
</div>