I am trying to make it so when someone fills out a single line name field in a table, the checkbox becomes required. Here is my current attempt at it:
$(document).ready(function () { $('.cf-table-block').change(function () { $('.tableclass').on('blur', 'input', checkdesc); }); function checkdesc() { $('.tableclass tbody tr').each(function () { if ($(this).find('.nameclass input').val() != "") { $(this).find('.checkboxclass input').attr('required', true); } else { $(this).find('.checkboxclass input').removeAttr('required'); } }); } });
However this keeps happening:
Even if you check all the boxes, it won't let you submit. What am I doing wrong? This logic works for non-checkbox fields so I'm guessing I'm missing something specific to checkboxes.