ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/webpack/javascripts/modules/Modules.TableRowClick.js

Summary

Maintainability
A
0 mins
Test Coverage
moj.Modules.TableRowClick = {
  init: function () {
    $('.js-checkbox-table').on('click', function (e) {
      const $target = $(e.target)
      if ($target.is(':checkbox, a')) {
        return
      }
      const $tr = $target.closest('tr')
      const $checkbox = $tr.find(':checkbox')

      $checkbox.prop('checked', !$checkbox.is(':checked'))

      e.preventDefault()
    })
  }
}