Created
July 26, 2013 06:53
-
-
Save kovaldn/6086826 to your computer and use it in GitHub Desktop.
JavaScript: prop & attr.js
This file contains hidden or 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
// СВОЙСТВА И АТРИБУТЫ: prop and attr | |
// ======================================= | |
// PROP - для disabled | |
// правильно | |
$("input").prop('disabled', true); | |
$("input").prop('disabled', false); | |
// не правильно! | |
// $("input").attr('disabled','disabled'); | |
// $("input").removeAttr('disabled'); | |
// если только один элемент, то быстрее будет: | |
this.disabled = true; | |
// ======================================= | |
// ATTR - для class, title и пр. | |
$("div").attr({"class":"divEl", "title":"Див"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment