i'm making list of options radio buttons, these inside table, belongs td.
i've tried highlight table row color when pressing radio button, highlights table rows , not 1 pressed.
once press, instance: option 1. want highlight option 1.
look @ example:  look jsfiddle
updated jquery function on jsfiddle code here (https://jsfiddle.net/b4w0cnbf/7/)
$('input[type="radio"]').click(function() {     $('.crimeoption').removeclass('checked');     if($(this).is(':checked')) {         $(this).closest('.crimeoption').addclass('checked');     } }); updating jquery code per comment request, updated jsfiddle link:
$('input[type="radio"]').click(function(e) {     $(this).closest('.crimeoption').trigger('click'); });  $('.crimeoption').click(function() {     $('.crimeoption').removeclass('checked');     if($(this).find('input[type="radio"]').is(':checked')) {         $(this).find('input[type="radio"]').prop("checked", false);         //$(this).addclass('checked');     } else {         $(this).find('input[type="radio"]').prop("checked", true);         $(this).addclass('checked');     }  }); 
Comments
Post a Comment