Skip to content

Instantly share code, notes, and snippets.

@khoand0000
Last active December 3, 2015 11:22
Show Gist options
  • Save khoand0000/57b7e427d2f6cba4b7c5 to your computer and use it in GitHub Desktop.
Save khoand0000/57b7e427d2f6cba4b7c5 to your computer and use it in GitHub Desktop.
Make `click` event is working on disabled input. Ref: http://stackoverflow.com/questions/3100319/event-on-a-disabled-input

Wrap disabled <input> in <div> and catch click event on <div> instead of <input> directly

<div class="disabled"> 
  <input type="text" disabled/>
</div>
$('.disabled').click(function(e){});
// $('[disabled]').click(function(e){}); // not working

The solution is not working with <select> and <input type="file">. I tried to using <fieldset disabled> wrap <select> but it is working too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment