Created
January 12, 2016 14:30
-
-
Save wtrocki/4b5005bb211ddf56451d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Common JQuery helper methods | |
// Author [email protected] | |
/** | |
* Mark element as disabled. | |
* Note: this method is not removing custom events connected to element. | |
* | |
* @param disabled boolean - true if element should be disabled | |
* @returns {$} | |
*/ | |
$.fn.disableElement = function (disabled){ | |
if (disabled){ | |
// Compatible with XHTML and HTML5 | |
this.attr("disabled", true); | |
} else{ | |
this.removeAttr('disabled'); | |
} | |
return this; | |
}; | |
/** | |
* Get element disabled state | |
* | |
* returns true if element is disabled, false otherwise | |
*/ | |
$.fn.isDisabled = function (){ | |
return !!this.attr("disabled"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment