Radio button .selected class when chosen

Use this code in your custom .js file to add a .selected class to the parent of the selected radio button

 

//add class .selected to the parent of the radio button checked in gravity forms.
$(‘input:radio’).click(function() {
$(‘input:radio[name=’+$(this).attr(‘name’)+’]’).parent().removeClass(‘selected’);
$(this).parent().addClass(‘selected’);

});

Leave a Reply