[jQuery] radio button value
How do I get the current value of a radio button?
This is my html:
<input type="radio" name="mem_type" id="mem0" value="regular" />
<input type="radio" name="mem_type" id="mem1" value="annual" checked="checked" />
and the javascript:
function showval() {
var t = $("input[name='mem_type']").val();
alert("mem_type = " + t);
}
$(function() {
$("input[name='mem_type']").change(showval);
});
This always gives me 'regular'.
What am I getting wrong?
--
"If we think happy thoughts, we will be happy. If we think miserable
thoughts, we will be miserable." -- Dale Carnegie
Rick Pasotto rick@niof.net http://www.niof.net