Amit D has Published 118 Articles

How to get the value of custom attribute in jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:44:48

1K+ Views

To get the value in jQuery, use the data-attributes with the data() method. You can try to run the following code to implement how to get the value of custom attribute:ExampleLive Demo           Selector Example                      $(document).ready(function() {             alert($('#my_id').data('original-title'));          });                               Demo    

How to get the value of src attribute in jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:43:51

4K+ Views

To get the value of src attribute in jQuery is quite easy. We will get the src attribute of the img tag. This attribute has the URL of the image. Let’s first see how we can add jQuery −You can try to run the following code to learn how to get the ... Read More

How to get the value of id attribute in jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:42:47

2K+ Views

Use jQuery attr() method to get the value of id attribute. You can try to run the following code to learn how to get the value in jQuery −ExampleLive Demo           jQuery Example                          $(document).ready(function() {             alert($('#div1').attr('id'));          });                                          This is demo text.          

How to get an attribute value in jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:40:41

2K+ Views

To get an attribute value in jQuery is quite easy. For this, use the jQuery attr() method. You can try to run the following code to learn how to get an attribute value in jQuery −ExampleLive Demo           jQuery Example       ... Read More

How to select multiple elements with jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:39:51

312 Views

With jQuery, you can easily select multiple elements.  Here’s how you can select for multiple elements such as and ,$("h1, p")You can try to run the following code to learn how to select multiple elements with jQuery −ExampleLive Demo           jQuery Example     ... Read More

How to select a single element which matches the given ID using jQuery?

Amit D

Amit D

Updated on 13-Feb-2020 09:38:48

244 Views

To select a single element which matches with the given ID using jQuery, use the element id selector. Here’s how, $('#elementid')You can try to run the following code to learn how to select a single element which matches with the given ID using jQuery −ExampleLive Demo         ... Read More

How to use universal (*) selector in jQuery?

Amit D

Amit D

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

192 Views

The universal selector selects all the elements available in the document. Here’s how to use it:$('*')ExampleYou can try to run the following code to learn how to implement Universal Selector in jQuery −Live Demo           jQuery Universal Selector               ... Read More

How to combine a class selector and an attribute selector with jQuery?

Amit D

Amit D

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

405 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. We can easily combine a class selector and an attribute selector with jQuery.You can try to run the following code to learn how to How to ... Read More

How to find an element based on a data-attribute value using jQuery

Amit D

Amit D

Updated on 13-Feb-2020 09:23:08

3K+ Views

To find an element based on a data-attribute value using jQuery is quite easy. Try to run the following code to find an element based on a data-attribute value −ExampleLive Demo    $(document).ready(function() {      $('[data-slide="0"]').addClass('demo');    }); .demo {     font-size: 150%;     color: red; } Rocky Amit John

How to call a jQuery plugin function outside the plugin?

Amit D

Amit D

Updated on 12-Feb-2020 10:31:35

266 Views

jQuery is a JavaScript library introduced to make development with JavaScript easier. It reduces the development time. Let us see how to call a jQuery plugin function outside the plugin.For calling, wrap the jQuery method for returning the instance of the constructor. Call prototype methods on it.example$.fn.myFunction = function(config){   ... Read More

Previous 1 ... 3 4 5 6 7 ... 12 Next
Advertisements