Home › Forums › JavaScript › Selecting radio button when table-row is clicked › Reply To: Selecting radio button when table-row is clicked
February 11, 2016 at 4:00 am
#237938
Participant
Aside from the selected
class needed on the <tr>
I’ve managed to get this ‘working’ using the following script:
$('.product-options tr').click(function() {
$(this).find('td input[type=radio]').prop('checked', true);
// $(this).find('td .radio span').addClass('checked', true);
});
One side issue I have is I use uniform.js to style my selects, radio and checkboxes. This wraps radio buttons like so (so they can be styled):
<div class="radio">
<span class="checked">
<input type="radio" name="product_variation" checked="checked" />
</span>
</div>
<div class="radio">
<span>
<input type="radio" name="product_variation" />
</span>
</div>
Clicked directly on the radio button changes the checked
class accordingly on the radio div/span. But if you click a table row, it does not. How could I go about ensuring the checked class (styling) on .radio span
matches that of the input?