I'm not sure what I'm doing incorrectly but I'm attempting to populate a string value into a field based upon a checkbox being ticked and clear the string when it's unticked.
- Checkboxes = #q12
- The first checkbox in a group of 11 has the ID of #Field12-0
- The individual input field I'd like to populate with a string is #q1
- These checkboxes are also being used to trigger show/hide lookup rules (in case that impacts the discussion).
Any help pinpointing what I'm doing incorrectly would be fantastic, I've tried this a few ways and am obviously just doing something really wrong.
$(document).ready(function () { $('#Field12-0 input').change(function() { if ($('#Field12-0 input:checked').val() == 'yes'){ $('#q1 input').val("yes"); } else { $('#q1 input').val(""); } } });
Thanks for any advice!