chihung
4/11/2019 - 8:28 AM

HIGHLIGHT WHEN ONCLICK RADIO BUTTON

/*
 * HIGHLIGHT WHEN ONCLICK RADIO
 * ----------------------------------------------- */
$(document).ready(function() {
  $(".table-description tr").on("click",function() {
    if($(this).find('input[type="radio"]').is(':checked')) {
      $('.table-description tr').removeClass('tr-highlight');
      $(this).addClass('tr-highlight');
    }
  });
});


<table class="table table-bordered table-gray table-description">
                            <thead>
                            <tr>
                                <th>
                                    カラー/サイズ
                                </th>
                                <th>
                                    在庫
                                </th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <th>
                                    ブラック/Sサイズ
                                </th>
                                <td>
                                    <input type="radio" name="description">
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    ブラック/Mサイズ
                                </th>
                                <td>
                                    <input type="radio" name="description">
                                </td>
                            </tr>
                            </tbody>
                        </table>