- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9053 Articles for Front End Technology
200 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
409 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
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
772 Views
With jQuery, it’s easy to get selected text from a drop-down list with :selected. This is done using the select id. You can try to run the following code to learn how to get selected text from a drop-down list using jQuery −ExampleLive Demo jQuery Selector $(document).ready(function() { $("#submit").click(function(){ $("#myselection option:selected").text(); alert( $("#myselection option:selected").text() ); }); }); The selected value: First Second Result
163 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
130 Views
Using jQuery, you can detect if a specific element in the page is hidden or visible with is(:visible). You can try to run the following code to learn how to check if an element is hidden in jQuery or not −ExampleLive Demo jQuery Selector $(document).ready(function() { $("#button1").click(function(){ var visible = $('#myElement').is(':visible'); if(visible) { alert("input element is visible"); } else { alert("input element is hidden"); } }); }); Check Visibility
311 Views
The element ID selector selects a single element with the given id attributes. Here’s how you can select:$('#elementid')You can try to run the following code to learn how to select an element by its ID attribute using jQuery:Live Demo jQuery Selector $(document).ready(function() { $("#div2").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
1K+ 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.
582 Views
The element class selector selects all the elements which match with the given class of the elements. Use the css() method to change the background color.You can try to run the following code to learn how to select an element by its class name using jQuery:Live Demo jQuery Selector $(document).ready(function() { $(".big").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
To Continue Learning Please Login
Login with Google