What I love about jQuery is its effectiveness in dealing with DOM manipulation. You can easily select, add or remove classes in your html document. You can also manipulate html attributes on the fly. For example if you want to disable / enable element, all you have to do is to set disabled attribute to "disabled" using the following code.
To enable it just simply removed the added "disabled" attribute or you can assign an empty string value to disabled attribute.
OR
/* to disable */ $('.myElement').attr('disabled', 'disabled');
To enable it just simply removed the added "disabled" attribute or you can assign an empty string value to disabled attribute.
$('.myElement').attr('disabled', '');
OR
$('.myElement').removeAttr('disabled');
3 comments:
For people coming from Google: Note that this post is out of date. You should use the .prop method in 1.6+:
$('element').prop('disabled', true);
$('element').prop('disabled', false);
Thanks for sharing...
Hey guys great post and good information
website development company in bangalore
Post a Comment