1

Is there a jquery plugin or custom tag to add simple enable-button-on-checked-box? I'm using Twitter Bootstrap 3 and I'd like to avoid:

  1. writing hacky Javascript in my project
  2. reinvening the wheel.

I have a typical use-case of disabling the submit button until the user accepts the privacy terms by checking the checkbox input:

<div class="form-group agreement_checkbox check_box">
  <label for="contact-sbcr-agreement" class="checkbox-inline">
    <p>
      <input id="contact-sbcr-agreement" class="checkbox-custom" type="checkbox" name="Privacy_Policy-Agreement" value="Got acknowledged and Agreed" data-constraints='@Required(message="You must agree with Privacy Policy to proceed.")'><span>Check here to indicate that you have read and agree to the terms of <a  target="_blank" href="privacy.html">Privacy Policy</a>.</span>
    </p>
  </label>
</div>
<div class="text-center text-sm-left offset-top-20">
  <button class="btn btn-primary" type="submit">Send</button>
</div>
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
  • 1
    This can be achieved by writing one line of code [see here](https://stackoverflow.com/questions/18110865/how-to-disable-enable-a-button-with-a-checkbox-if-checked) (this is not a hack)... I don't know of any plugin than you can include in your project... but even if you find a plugin, does't really worth adding the overhead of an extra plugin to avoid writing one line of code? – Hooman Bahreini Oct 01 '19 at 22:41
  • 1
    Completely agree with @HoomanBahreini. Avoiding the reinvention of the wheel is a great methodology, but this is hardly a wheel, it is as he mentioned a simple one line code. If you pull in a plugin to do this, I guarantee it will be more hacky, harder to trace, harder to modify, and cost more in overhead. Sometimes you need to write code yourself. – James Hay Oct 02 '19 at 02:24

0 Answers0