jQuery prepend()

The jQuery prepend() inserts content at the beginning of the selected elements. Syntax: $(selector).prepend(content,function(index,html)) Content: Content is a compulsory parameter of the jQuery prepend() method, as it specifies the content to insert at the beginning of the selected element. It can accept the following values: HTML elements, jQuery objects, and DOM elements. Function: It is … Read more

jQuery before()

jQuery before() method is used to insert the specified content before each element in the set of matched elements. jQuery before() inserts content before the selected elements. Syntax: $(selector).before(content, function(index)) Content: Content is a compulsory parameter of the jQuery before() method, as it specifies the content to insert before the selected element. It can accept … Read more

jQuery css()

jQuery css() method can either be used to set a specified CSS property ( where it sets the CSS property for ALL matched elements) or can be used to return the value of a specified CSS property ( where it returns the CSS property value of the FIRST matched element). jQuery css() sets or returns … Read more

jQuery val()

jQuery val() method can either be used to get the current value of the first element in the set of matched elements or to set the value of every matched element. jQuery val() sets or returns the value attribute of the selected elements. Syntax: When it is used to get value. $(selector).val() When it is … Read more

jQuery text()

jQuery text() method can either be used to set text content ( where it overwrites the content of all matched elements) or can be used to return the text content ( where it returns the combined text content of all matched elements without the HTML markup). jQuery text() sets or returns the text content of … Read more

jQuery html()

jQuery html() method can either be used to set content ( where it overwrites the content of all the matched elements) or can be used to return content ( where it returns the content of the first matched element). jQuery html() sets or returns the content of selected elements. Syntax: When it is used to … Read more

jQuery delay()

The jQuery delay() method can be used to make a delay between the queued jQuery effects. Example: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <script> $(document).ready(function(){ $(“button”).click(function(){ $(“#div1″).delay(3000).fadeIn(); }); }); </script> </head> <body> <button>Click me</button><br> <div id=”div1″ style=”width:90px;height:90px;display:none;background-color:black;”></div><br> </body> </html> Syntax: $(selector).delay (speed, queueName) Speed: Speed is an optional parameter whose value specifies the speed of … Read more

jQuery animate()

jQuery library supports the animate() method which can be used to create custom animations. Syntax: $(selector).animate({params},speed,callback); Params is a required parameter that is used to set the desired CSS properties for the animation. The optional parameters like speed and callback are the same as in other jQuery effect methods. Important features of jQuery animate(): The … Read more

jQuery slideToggle()

The jQuery fadeToggle() method slides the elements upside, if the elements have been slid down, and slides the elements down if the elements have been slid up. The jQuery slideToggle() method is used to toggle the elements in between the slideUp() and slideDown() methods. Example: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <script> $(document).ready(function(){ $(“#flip”).click(function(){ $(“#panel”).slideToggle(); … Read more

jQuery slideUp()

Sliding the elements upside down is one of the sliding effects that the jQuery library supports. The slideUp() method is used to slide up the selected elements. Example: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <script> $(document).ready(function(){ $(“#flip”).click(function(){ $(“#panel”).slideUp(); }); }); </script> <style> #panel, #flip {padding: 2px;text-align: center;background-color: yellow;border: solid 5px red;} #panel { padding: 50px; … Read more