Author: admin

  • CSS Properties

    jQuery – Get CSS Properties jQuery css() method can be used to get the value of a CSS property associated with the first matched HTML element. Following is the syntax of the css() method: jQuery understands and returns the correct value for both css( “background-color” ) and css( “backgroundColor” ). Example Let’s try the following example and verify the result. This should…

  • Dimensions

    jQuery provides various methods to get and set the CSS dimensions for the various properties. Following diagram explains how various dimensions (width, height, innerWidth, innerHeight, outerWidth, outerHeight) can be depicted for any HTML element: jQuery Dimension Methods Following are the methods to manipulate CSS dimensions for the various properties of the HTML elements. jQuery width()…

  • CSS Classes

    jQuery – Adding CSS Classes jQuery provides addClass() method to add a CSS class to the matched HTML element(s). Following is the syntax of the addClass() method: $(selector).addClass(className); This method takes a parameter which is one or more space-separated classes to be added to the class attribute of each matched element. More than one class may be added at…

  • Replace Elements

    jQuery replaceWith() Method The jQuery replaceWith() method removes the content from the DOM and inserts a new content in it’s place. Following is the syntax of the replaceWith() method: Synopsis Consider the following HTML content: Now if we apply the replaceWith() method as follows: It will produce following result: If we had any number of nested elements inside <div class=”hello”>, they…

  • Remove Elements

    jQuery remove() Method The jQuery remove() method removes the selected element(s) and it’s child elements from the document. Following is the syntax of the remove() method: You should use remove() method when you want to remove the element itself, as well as everything inside it. Synopsis Consider the following HTML content: Now if we apply the remove() method as follows: It will produce…

  • Add Elements

    jQuery provides various methods to add new DOM elements in the existing HTML document. You can add these new elements at various locations (before, after any of the existing tags) based on your requirements. jQuery append() Method The jQuery append() method adds the content at the end of the matched each element(s). You can also append multiple…

  • DOM Manipulation

    jQuery provides a number of methods to manipulate DOM in efficient way. You do not need to write big and complex code to set or get the content of any HTML element. jQuery DOM Manipulation jQuery provides methods such as attr(), html(), text() and val() which act as getters and setters to manipulate the content from HTML documents. Here are some…

  • jQuery unwrap

    The jQuery unwrap() method is used to remove the parent element of the selected elements. Syntax: Example of jQuery unwrap() method Let’s take an example to demonstrate the jQuery unwrap() method. jQuery unwrap() example 2 Let’s take an example which shows wrap() and unwrap() method together.

  • jQuery wrapAll

    jQuery wrapAll() method is used to wrap specified HTML elements around all selected elements, in a set of matched elements. Syntax: Parameters of jQuery wrapAll() method Parameter Description wrappingElement It is a mandatory parameter. It specifies the HTML elements that you wrap around the selected elements. Its possible values are:HTML elementsjQuery objectsDOM elements Example of…

  • jQuery wrapInner

    The jQuery wrapInner() method is used to wrap an HTML structure around the content of each element in the set of matched element. This method can accept any string or object that could be passed to the $() factory function. Syntax: Parameters of jQuery wrapInner() method Parameter Description wrappingElement It is a mandatory parameter. It…