Guest User

Untitled

a guest
Jun 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. (function($) {
  2. $.fn.enable = function() {
  3. // Enable each selected element by removing its 'disabled' attribute.
  4.  
  5. return this.each(function() {
  6. $(this).removeAttr('disabled');
  7. });
  8. };
  9.  
  10. $.fn.disable = function() {
  11. return this.each(function() {
  12. // Disable each selected element that is a form control by setting
  13. // its 'disabled' attribute.
  14.  
  15. if ($(this).is(':input')) {
  16. $(this).attr('disabled', 'disabled');
  17. }
  18. });
  19. };
  20. })(jQuery);
Add Comment
Please, Sign In to add comment