David Meador has Published 164 Articles

How to get the input value of the first matched element using jQuery?

David Meador

David Meador

Updated on 14-Feb-2020 05:21:14

811 Views

To get the input value of the first matched element using jQuery, use the .first() method.ExampleYou can try to run the following code to get the input value of the first matched element using jQuery −Live Demo                     ... Read More

What is the difference between text() and html() in jQuery?

David Meador

David Meador

Updated on 14-Feb-2020 05:18:33

354 Views

jQuery comes with a lot of methods to manipulate attributes. These are DOM related methods. The attributes include, text() and html() too, text() – This method sets or returns the text content of elements selected.html() – This method sets or returns the content of elements selected.ExampleYou can try to run ... Read More

How to get text contents of all matched elements using jQuery?

David Meador

David Meador

Updated on 14-Feb-2020 05:15:22

311 Views

To get the text contents of all matched elements using jQuery, use the text() method. You can try to run the following code to get text contents of all matched elements using jQuery −ExampleLive Demo           The Selector Example             ... Read More

What is $(window).load() method in jQuery?

David Meador

David Meador

Updated on 14-Feb-2020 04:57:45

4K+ Views

The code which gets included inside $( window ).on( "load", function() { ... }) runs only once the entire page is ready (not only DOM).Note: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before ... Read More

How should I initialize jQuery in a web page?

David Meador

David Meador

Updated on 14-Feb-2020 04:56:43

1K+ Views

To initialize jQuery in a web easy is quite easy. You can try to run the following code to learn how to initialize jQuery in a web page. We’re using Google CDN to add jQuery. Microsoft CDN is also available for the same purpose of adding jQuery library to HTML.ExampleLive ... Read More

How to add a class on click of anchor tag using jQuery?

David Meador

David Meador

Updated on 13-Feb-2020 09:56:22

1K+ Views

To add a class on click of anchor tag using jQuery, use the addClass() method. You can try to run the following code to learn how to implement adding a class on click of anchor tag using jQuery −ExampleLive Demo                 ... Read More

How to use attr() method in jQuery to get the value of an attribute?

David Meador

David Meador

Updated on 13-Feb-2020 09:45:45

305 Views

The jQuery attr() method is used to get the value of an attribute, with the attribute, for example, href. Mention the attribute as the parameter of the attr() method.You can try to run the following code to learn how to use the attr() method to get the value of an ... Read More

How can I select an element by tag name using jQuery?

David Meador

David Meador

Updated on 13-Feb-2020 07:28:34

1K+ Views

Using jQuery selector, you can select an element by tag name. The jQuery element selector selects elements.ExampleTry to run the following code to learn how to select an element by tag name using jQuery −Live Demo           jQuery Selector Example         ... Read More

What are jQuery Selectors?

David Meador

David Meador

Updated on 13-Feb-2020 07:27:20

153 Views

A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria.Selectors are used to select one or more HTML elements using jQuery. Once an element is selected then we can perform various operations on that selected element. ... Read More

How to concatenate variable in a string in jQuery?

David Meador

David Meador

Updated on 13-Feb-2020 07:25:09

6K+ Views

You can easily concatenate variable in a string in jQuery, using the jQuery html() method. Try to run the following code to learn how to use variable in a string with jQuery −ExampleLive Demo     $(function(){       $("a").click(function(){         var ... Read More

Advertisements