Given the following code, jQuery seems to only alert "1" as the value even after the user has selected radiobutton 2. What am I missing here? Shouldn't the trailing jQuery alert "2" when the second radiobutton is selected?
<p>
Coal <input type="radio" name="example" value="1" checked />
Candy <input type="radio" name="example" value="2" />
</p>
I'm using this code in firebug to test:
r = $(":radio[name='example']").val();
alert(r);