I have a fieldset with two radio buttons inside. When a radio button is clicked, I want to retrieve the value of the clicked button. However, my current jQuery code is not functioning correctly and I would appreciate any assistance.
HTML:
<fieldset id="skin-complexion" name="properties[skin_complexion]">
<img src="{{ 'icon-fair.png' | asset_url }}">
<input type="radio" value="Fair" />
Fair
<img src="{{ 'icon-medium.png' | asset_url }}">
Medium
<input type="radio" value="Medium" />
</fieldset>
jQuery:
$('#skin-complexion').on('change', function() {
var value = $(this).val();
alert(value);
});
My jQuery code above is not working. Any help is appreciated.