Amit D has Published 118 Articles

What are the best practices to improve jQuery selector performance?

Amit D

Amit D

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

822 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

How to remove DOM elements in jQuery?

Amit D

Amit D

Updated on 09-Dec-2019 06:30:41

379 Views

The empty( ) method remove all child nodes from the set of matched elements whereas the method remove( expr ) method removes all matched elements from the DOM.ExampleYou can try to run the following code to learn how to remove DOM elements in jQuery:Live Demo           ... Read More

How to write a jQuery selector for the label of a checkbox?

Amit D

Amit D

Updated on 09-Dec-2019 06:16:03

2K+ Views

To write a jQuery selector for the label of a checkbox, use the for attribute of label element.ExampleYou can try to run the following code to learn how to write a jQuery selector for the label of a checkbox:Live Demo $(document).ready(function(){    $("label[for='mysubjects1']").css("background-color", "yellow");    $("label[for='mysubjects2']").css("background-color", ... Read More

How to pass a variable into a jQuery attribute-contains selector?

Amit D

Amit D

Updated on 06-Dec-2019 11:09:32

3K+ Views

Yes, it is possible to pass a variable into a jQuery attribute-contains selector. The [attribute*=value] selector is used to select each element with a specific attribute and a value containing a string.ExampleYou can try to run the following code to learn how to pass a variable into a jQuery attribute-contains ... Read More

How to make jQuery attribute selector case insensitive?

Amit D

Amit D

Updated on 06-Dec-2019 11:02:22

790 Views

To make jQuery attribute selector case insensitive, create two buttons and manipulate the input with attribute selector.ExampleYou can try to run the following code to make jQuery attribute selector case insensitive:Live Demo                          $(document).ready(function(){     ... Read More

How to call a jQuery plugin without specifying any elements?

Amit D

Amit D

Updated on 04-Dec-2019 07:02:17

169 Views

To call a jQuery plugin without specifying any elements, use extend method. Here’s a snippet showing how to call a jQuery plugin without specifying any elements:$.fn.extend({   myFunction1: function(){...} }); $.extend({   myFunction2: function(){...} });Above, you can see we’re calling myFunction1 and myFunction2 without specifying any elements and using ... Read More

How do I add a simple jQuery script to WordPress?

Amit D

Amit D

Updated on 04-Dec-2019 07:01:14

238 Views

WordPress is an open source CMS, used to develop dynamic websites. Let’s learn how to add jQuery script to WordPress. In the WordPress Theme folder, create a folder "js", and add a file in that. That file will be your Query file with extension “.js”. Add your jQuery script to that ... Read More

How to trigger a hover event from another element using jQuery?

Amit D

Amit D

Updated on 30-Jul-2019 22:30:20

342 Views

Trigger a hover event from another element, using the hover() method over the selected element.You can try to run the following code to learn how to trigger a hover event from another element using jQuery:

Advertisements