Get Previously Checked Radio Button
Given a set of radio buttons, like:
Solution 1:
Try this - http://jsfiddle.net/H6h4R/1/
$(":radio").on("mousedown", function() {
$("p").text( $('input[type=radio]:checked').val() );
}).on("mouseup", function() {
$('input[type=radio]').prop('checked', false);
$(this).prop('checked', true);
});
The click
event is only triggered after this exact series of events:
- The mouse button is depressed while the pointer is inside the element.
- The mouse button is released while the pointer is inside the element.
Solution 2:
if he uses keyboard key this can help with that
$('input[name=radios]').keydown(function(){
alert("Before change "+$('input[name=radios]:checked').val());
})
Post a Comment for "Get Previously Checked Radio Button"