jQuery addClass example

Change class name on click in jQuery

by Steve

HTML

<div class="checkbox" id="other_3">
  <label for="other_3">
      <input type="checkbox">
      Other
  </label>
  <div class="other-group">
      <label for="other_3">Other</label>
      <input type="text" id="other_3-otext">
  </div>
</div>

JavaScript

$(document).ready(function() {
    $('.checkbox label[for*="other"]').on('click', function() {
        $(this).next().toggle();
    })

});