jQuery Articles

Page 13 of 42

What is difference between innerWidth and outerWidth in jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 342 Views

innerWidth in jQuery The innerWidth() method returns the inner width of the first matched element. It includes padding, but excludes border and margin. This method is useful when you need to calculate the content area plus padding of an element. Example You can try to run the following code to get the inner width in jQuery − ...

Read More

What is the difference between height and outerHeight in jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 2K+ Views

height() in jQuery The height() method returns the vertical measurement of an element's content area. It excludes padding, border, and margin, giving you only the inner height of the element. To get the height of an element in jQuery, use the height() method. Example You can try to run the following code to get the height − ...

Read More

How to set width and height of an element using jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 4K+ Views

To set the width and height of an element using jQuery, use the width() and height() methods in jQuery. These methods allow you to dynamically modify element dimensions with pixel values or other CSS units. Setting Width of an Element The width()

Read More

How jQuery selects elements using CSS?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 557 Views

jQuery uses CSS selectors to select and manipulate elements on a web page. This powerful feature allows you to target HTML elements using the same syntax you would use in CSS stylesheets. The css(name) method returns a style property value from the first matched element. CSS Selector Syntax jQuery follows standard CSS selector patterns to identify elements − $("element") − Selects all elements of a specific type $("#id") − Selects element by ID $(".class") − Selects elements by class name $("element.class") − Selects elements ...

Read More

How to define multiple CSS attributes in jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 2K+ Views

To define multiple CSS attributes in jQuery, use the css() method or the addClass() method. Let's see how to do it using the css() method. When using the css() method to set multiple properties, you need to pass an object where you pair up strings representing property names with their corresponding values. This allows you to modify several CSS properties at once in a single jQuery statement. Example You can try to run the following code to learn how to define multiple CSS attributes in jQuery − ...

Read More

How to find all the siblings for the clicked element in jQuery?

Amit D
Amit D
Updated on 13-Mar-2026 837 Views

To find all the siblings for the clicked element in jQuery, use the siblings() method along with proper element selection. The siblings() method returns all sibling elements of the selected element, which are elements that share the same parent. Understanding the siblings() Method The siblings() method in jQuery selects all sibling elements of the matched element. When combined with click events, you can easily identify and manipulate all related elements in the same container. Example You can try to run the following code to find all the siblings for the clicked element in jQuery − ...

Read More

How do I select text nodes with jQuery?

Nizam Techs
Nizam Techs
Updated on 13-Mar-2026 295 Views

jQuery provides several methods to select and manipulate text nodes within the DOM. Text nodes are the actual text content inside HTML elements, separate from the element tags themselves. Using the contents() Method The most effective way to select text nodes in jQuery is using the contents() method combined with a filter. The contents() method returns all direct children of selected elements, including text nodes. Example Here's how to select and manipulate text nodes − ...

Read More

What do you understand by jQuery Traversing Siblings?

David Meador
David Meador
Updated on 13-Mar-2026 183 Views

jQuery traversing siblings is used to traverse and find sibling elements using jQuery. To traverse sideways in the DOM tree, you can use the following methods − siblings() − This returns all the sibling elements of the selected element. next() − This method returns the next sibling element of the selected element. ...

Read More

How to add the previous element to current jQuery selection?

David Meador
David Meador
Updated on 13-Mar-2026 658 Views

To add the previous element to current jQuery selection, use the insertBefore() method. This method inserts selected elements before the specified target element in the DOM. Syntax The basic syntax of the insertBefore() method is − $(content).insertBefore(target) Where content is the element to be inserted and target is the element before which the content will be placed. Example You can try to run the following code to learn how to work with insertBefore() method − ...

Read More

How to filter object array based on attributes in jQuery?

David Meador
David Meador
Updated on 13-Mar-2026 2K+ Views

To filter object array based on attributes in jQuery, use the map() method with JSON. The $.map() function creates a new array with the results of calling a provided function on every element in the calling array. Example You can try to run the following code to learn how to filter object array based on attributes in jQuery. This example filters department data based on employee count and shares criteria − ...

Read More
Showing 121–130 of 413 articles
« Prev 1 11 12 13 14 15 42 Next »
Advertisements