There is a radio button group define as below:
<input type="radio" name="type0" value="$">$<input type="radio" name="type0" value="%">%
Need to check the first radio button whose value = $
.
The problem is the below code doesn't accomplish this. Need some way of escaping $
$('input[type=radio][value=$]').attr('checked','checked');
$('input[type=radio][value="$"]').first().attr('checked','checked');
this works for me, enclose the selector in double quotes and the attribute selector in single ones
$("input[type=radio][value='$']").attr('checked','checked');
http://jsfiddle.net/BuvKT/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With