
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 730 Articles for JQuery

290 Views
The jQuery.slice() method is used to select subset of elements. It uses an index to set the selection. You can use it without arguments. Without argument, it will select all the elements.The slice() is equal to slice(0) i.e. without arguments.ExampleYou can try to run the following code to use jQuery slice() method without arguments:Live Demo $(document).ready(function(){ $("p").slice(0).css("background-color", "gray"); }); Heading 1 This is demo text 1. This is demo text 2. This is demo text 3.

17K+ Views
Apply multiple CSS properties using jQuery CSS( {key1:val1, key2:val2....}) method. We can apply as many properties as we like in a single call. Syntax In the below mentioned way we can use the CSS. Here you can pass key as property and val as its value of that property. selector.css( {key1:val1, key2:val2....keyN:valN}) Define Multiple CSS Attributes in jQuery As we mentioned earlier that we will be using jQuery css() method to apply multpile CSS properties on any element. First we will use '$(selector)' to select the element where we wants to apply ... Read More

2K+ Views
To define multiple CSS attributes in jQuery, use the css selector or the addClass() method. Let’s see how to do it using css selector.Pair up strings representing property names with the corresponding values.ExampleYou can try to run the following code to learn how to define multiple CSS attributes in jQuery:Live Demo $(document).ready(function(){ $("#demo").css({ "background-color": "#F1F1F1", "font-style" : "italic" }); }); Countries

864 Views
To apply CSS properties using jQuery, use the css() method. It’s easy to apply any CSS property using jQuery method css( PropertyName, PropertyValue ).Here is the syntax for the method −selector.css( PropertyName, PropertyValue );ExampleHere you can pass PropertyName as a JavaScript string and based on its value, PropertyValue could be string or integer.Live Demo jQuery css() method $(document).ready(function() { $("li").eq(4).css("color", "green"); }); list item 1 list item 2 list item 3 list item 4 list item 5 list item 6

221 Views
The jQuery library supports nearly all of the selectors included in Cascading Style Sheet (CSS) specifications 1 through 3, as outlined on the World Wide Web Consortium's site.Using jQuery library developers can enhance their websites without worrying about browsers and their versions as long as the browsers have JavaScript enabled.Most of the JQuery CSS Methods do not modify the content of the jQuery object and they are used to apply CSS properties on DOM elements.To apply any CSS property using jQuery method css( PropertyName, PropertyValue ).Here is the syntax for the method −selector.css( PropertyName, PropertyValue );Here you can pass PropertyName as ... Read More

775 Views
To find all the siblings for the clicked element in jQuery, use the parent and siblings method, and select the class to find all siblings.ExampleYou can try to run the following code to find all the siblings for the clicked element in jQuery:Live Demo $(document).ready(function(){ $(".target").click(function(){ $(this).parent().siblings().removeClass("selectedClass"); $(this).parent().addClass("selectedClass"); }); }); a { cursor:pointer; } .selectedClass{ color:blue; } Countries India US UK

2K+ Views
To remove all child nodes from a parent in jQuery, use the empty() method.ExampleThe jQuery empty() method removes all child nodes of the set of matched elements from the DOM.Live Demo $(document).ready(function(){ $("button").click(function() { $("#demo").empty(); }); }); India US UK Remove all child nodes

488 Views
The answer to which one is the fastest between children() and find() method depends on the usage. The find() method traverses the entire Dom whereas the children() method gets the immediate children of the node.jQuery children() methodThe children() method is to get the immediate children of the node. The children( [selector] ) method gets a set of elements containing all of the unique immediate children of each of the matched set of elements.Here is the description of all the parameters used by this method −selector − This is an optional argument to filter out all the childrens. If not supplied then ... Read More

734 Views
To find all siblings of currently selected object in jQuery, use the siblings() method. The siblings( [selector] ) method gets a set of elements containing all of the unique siblings of each of the matched set of elements.Here is the description of all the parameters used by this method −selector − This is optional selector to filter the sibling Elements with.ExampleYou can try to run the following code to learn how to find all siblings:Live Demo jQuery siblings() method $(document).ready(function(){ $("p").siblings('.selected').addClass("highlight"); }); .highlight { background:yellow; } Hello Hello Again And Again