Use Universal Selector in jQuery

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

357 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                          $(document).ready(function() {             /* This would select all the elements */             $("*").css("background-color", "yellow");          });                                          This is first division of the DOM.                      This is second division of the DOM.                      This is third division of the DOM          

Combine Class Selector and Attribute Selector with jQuery

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

608 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 combine a class selector and an attribute selector with jQuery −ExampleLive Demo                       $(document).ready(function() {          $('.myclass[reference="12345"]').css("background-color", "yellow");       });                                             Row 1 Column 1                                 Row 2 Column 1                                 Row 3 Column 1                    

Find Element Based on Data Attribute Value using jQuery

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

5K+ 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

Count Records from MySQL Table with Duplicate Triplicates

Daniol Thomas
Updated on 13-Feb-2020 07:53:40

149 Views

Suppose we have the following table named stock_item in which the column quantity is having duplicate values i.e. for item name ‘Notebooks’ and ‘Pencil’, the column ‘Quantity’ is having duplicate values ‘40’ and for items ‘Shirts’, ‘Shoes’ and ‘Trousers’ triplicate value 29 is hold by column ‘quantity’ as shown in the table.mysql> Select * from stock_item; +------------+----------+ | item_name  |quantity  | +------------+----------+ | Calculator | 89       | | Notebooks  | 40       | | Pencil     | 40       | | Pens       | 32       | | ... Read More

Know Selected Radio Button via jQuery

Ricky Barnes
Updated on 13-Feb-2020 07:37:01

283 Views

Use the jQuery val() method to get the value of the selected radio button. You can try to run the following code to learn how to know which radio button is selected via jQuery −ExampleLive Demo           jQuery Selector                      $(function(){            $("#submit").click(function(){                     alert($('input:radio:checked').val());           });          });                              Select a number:          1          2          3          Result          

Select Element with Specific Class and Title Attribute using jQuery

Ricky Barnes
Updated on 13-Feb-2020 07:33:37

2K+ Views

If your element is having a class and title attribute, still you can select it with jQuery. You can try to run the following code to learn how to select element with specific class and 'title' attribute using jQuery.ExampleLive Demo           The Selector Example                          $(document).ready(function() {             $(".big[title='one']").css("background-color", "yellow");          });                                          This is first division of the DOM.                        This is second division of the DOM.              

Count Total Duplicate Records in a MySQL Table

Abhinaya
Updated on 13-Feb-2020 07:31:52

2K+ Views

Suppose we have the following table named stock_item in which the column quantity is having duplicate values i.e. for item name ‘Notebooks’ and ‘Pencil’, the column ‘Quantity’ is having duplicate values ‘40’ and for items ‘Shirts’, ‘Shoes’ and ‘Trousers’ triplicate value 29 is hold by column ‘quantity’ as shown in the table.mysql> Select * from stock_item; +------------+----------+ | item_name  |quantity  | +------------+----------+ | Calculator |       89 | | Notebooks  |       40 | | Pencil     |       40 | | Pens       |       32 | | ... Read More

Select Element by Tag Name Using jQuery

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

2K+ 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                          $(document).ready(function() {             $("div").css("background-color", "yellow");          });                                  This is first division of the DOM.                      This is second division of the DOM.                      This is third division of the DOM              

What are jQuery Selectors

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

297 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. jQuery selectors start with the dollar sign and parentheses - $(). You can try to run the following code to learn how to work with jQuery Selectors −ExampleLive Demo           jQuery Selectors                     ... Read More

Concatenate Variable in a String in jQuery

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

7K+ 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 id= $(".id").html();         $('.demo').html("Welcome to ");                   });     });               Click me             Qries    

Advertisements