javascript - How to select latest checked radio button in multiple radio buttons with jQuery -
in from, how select jquery latest radiobutton selected user
<form id = "myform"> <h3>time work?</h3> <p> <input type="radio" name="work" value="hourly" /> <input type="radio" name="work" value="daily" /> <input type="radio" name="work" value="weekly" /> </p> <h3>your age?</h3> <p> <input type="radio" name="age" value="old" /> <input type="radio" name="age" value="young" /> <input type="radio" name="age" value="child" /> </p> </form>
i tried
$('input:checked', '#myform').val();
and
$('input[type='radio']:checked', '#myform').val();
but select value of first question! help?
try :
<script type="text/javascript"> jquery("input[type=radio]").click(function(){ alert(jquery(this).val()); }); </script>
Comments
Post a Comment