Amit D has Published 117 Articles

How to locate descendant elements of a particular type of elements in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 09:02:38

401 Views

Use the jQuery find() method to locate descendant elements of particular type of elements in jQuery. The jQuery.find() method will return the descendant elements of the selected element.ExampleYou can try to run the following code to learn how to work with jQuery.find() method, Live Demo  .myclass * ... Read More

How does jQuery.find() method work in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 09:01:28

173 Views

The jQuery.find() method will return the descendant elements of the selected element.ExampleYou can try to run the following code to learn how to work with jQuery.find() method, Live Demo .myclass * {     display: block;     border: 2px solid red;     padding: 2px;   ... Read More

How does jQuery.eq() method work in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 08:58:18

209 Views

If you want to return an element with a definite index number of the selected elements, then use the eq() method. The first element has index 0, the second element has index 1, etc. Yes, the index number starts at 0.ExampleYou can try to run the following code to learn ... Read More

How does jQuery.map() method work in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 08:57:13

508 Views

The map method translates a set of elements in the jQuery object into another set of values in a jQuery array which may, or may not contain elements.The following are the parameters of jQuery.map() method:callback − The function to execute on each element in the set.ExampleYou can try to run the ... Read More

How to select a subset of the matched elements in jQuery()?

Amit D

Amit D

Updated on 09-Dec-2019 08:55:37

316 Views

The slice( start, end ) method selects a subset of the matched elements. The following are the parameters of the slice() method:start − Where to start the subset. The first element is at zero. Can be negative to start from the end of the selection.end − Where to end the subset ... Read More

How to get substring of a string in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 08:52:02

6K+ Views

To get substring of a string in jQuery, use the substring() method. It has the following two parameters:from: The from parameter specifies the index where to start the substring.to: The to parameter is optional. It specifies the index where to stop the extraction. This is an optional parameter, which extracts ... Read More

What does jQuery.andSelf( ) method do in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 08:47:18

155 Views

The andSelf( ) method adds the previous selection to the current selection. The method is useful when you have multiple traversals in your script and then adding something that was matched before the last traversal.ExampleYou can try to run the following code to learn how to work with jQuery.andSelf() method:Live ... Read More

How to get objects by ID, Class, Tag, and Attribute in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 08:04:36

956 Views

Here’s how you can get objects by ID Selector (#id), by Class Selector (.class), by Tag, and Attribute (.attr()).Get Object by Class SelectorExampleThe element class selector selects all the elements which match with the given class of the elements.Live Demo           jQuery Selector       ... Read More

What is the difference between filter() and find() in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 07:40:19

367 Views

jQuery filter() methodThe jQuery filter() method will return elements matching a specific criteria.ExampleYou can try to run the following code to learn how to work with jQuery.filter() method, Live Demo   $(document).ready(function(){     $("p").filter(".myclass").css("background-color", "gray");   }); Tutorialspoint Free Text ... Read More

What are the best practices to improve jQuery selector performance?

Amit D

Amit D

Updated on 09-Dec-2019 06:48:46

2K+ Views

To enhance the performance of jQuery selector, you need to perform optimization. Here are some of the techniques:Cache SelectorCaching enhances the performance of the application. Cache your jQuery selectors for better performance. This can be done using the ID as your selector. For example, this caches the selector and stores ... Read More

Advertisements