.add() Method
.add() Add elements to the set of matched elements. HTML: <p>Hello</p><span>Hello Again</span> JQUERY: $("div").css("border", "2px solid red") .add("p") .css("background", "yellow"); This JQ will, Step : 1 find the div and apply the red to the
addClass() and removeClass()
Jquery .addClass() and .removeClass() used to add or remove CSS class dynamically in the Html element. For Example .addClass() $(‘#p1′).addClass(‘cssclass1’); Add a “cssclass1’ css class to elements that contain id of “p1″. .removeClass() $(‘#p1′).removeClass(‘cssclass1’); Remove
.find() vs .filter()
Both filter() and find() methods are very similar, except the former is applies to all the elements, while latter searches child elements only. find() searches the descendants of the elements in the matched set. filter()
Difference Between jQuery Text() And HTML()
In this post you will learn about the difference between jQuery text and HTML. .html() - This jQuery function gets/sets the HTML of any element. .text()- This jQuery function gets/sets the text (innertext) of
.append() VS .html()
.append() and .html() is the most usefull method in jQuery.But these are far different from one another, .append() add some value with the existing one. whether .html() do the same but it removes the old
Query append() VS appendTo()
Query append() and appendTo() append() : Append to end of the selected element HTML : <ul id="test"> <li>test</li> </ul> JQuery : jQuery("#test").append("<li>test1</li>"); OUTPUT : <ul id="test"> <li>test</li> <li>test1</li> </ul> appendTo : Append to
JQuery Selector
JQUERY SELECTORS : 1) selecting a particular element having a specific class $(".class1").css("border", "1px solid red"); 2) select all elements of the page $("*").css("border", "1px solid red"); 3) select an element that having a particular