Thursday, October 1, 2015

LESSON NOTES :: Quick Tips (JQ)

Quick Tips (JQuery)

What does $("div.parent") will select? All the div element with parent class.
Rem: jQuery’s empty() vs remove() vs detach()
jQuery.noConflict();
When .noConflict() is called then jQuery returns $() to its previous owner and you will need to use jQuery() instead of shorthand $() function.
How to Check element exists or not in jQuery?
jQuery provides length property for every element which returns 0 if element doesn't exists else length of the element.
if ($('#dvText').length) {  
        // your code  
}
Disable-Enable all controls of page using jQuery?
- disable and enable controls on click of button:
$(document).ready(function() {
        $("#btnEnableDisable").toggle(function() {
           $("*").attr("disabled", "disabled");
               $(this).attr("disabled", "");
            }, function() {
               $("*").attr("disabled", "");
   });
});
Rem: bind() vs live() vs delegate()
Basic Filters:

No comments:

Post a Comment