- Trending Categories
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 766 Articles for JQuery
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
484 Views
To get the width of an element using jQuery, use the width() method.ExampleYou can try to run the following code to get the width of an element using jQuery:Live Demo $(document).ready(function(){ $("button").click(function(){ alert("Width of element: " + $("div").width()); }); }); Get Width
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
2K+ Views
To get the height of a div element, use the height() method in jQuery.ExampleYou can try to run the following code to get the height of a div element using jQuery:Live Demo $(document).ready(function(){ $("button").click(function(){ alert("Height of div element: " + $("div").height()); }); }); Get Height of div
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
2K+ Views
The append (content) method appends content to the inside of every matched element, whereas the appendTo (selector) method appends all of the matched elements to another, specified, set of elements.jQuery append() functionThe append (content) method appends content to the inside of every matched element.Here is the description of all the parameters used by this method −content − Content to insert after each target. This could be HTML or Text contentExampleYou can try to run the following code to learn how to work with append() function in jQuery:Live Demo jQuery append() method ... Read More
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
2K+ Views
To get the width of a div element, use the width() method in jQuery.ExampleYou can try to run the following code to get the width of a div element using jQuery:Live Demo $(document).ready(function(){ $("button").click(function(){ alert("Width of div element: " + $("div").width()); }); }); Get Width of div
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
4K+ Views
To set the width and height of an element using jQuery, use the width() and height() in jQuery.Width of an elementExampleYou can try to run the following code to learn how to set the width of an element in jQuery:Live Demo $(document).ready(function(){ $("#button1").click(function(){ $("div").width(300); }); $("#button2").click(function(){ $("div").width(400); }); }); Width of div: 300 Width of div: 400 Height of an elementExampleYou can try to run the following code to learn how to set the ... Read More
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
407 Views
jQuery uses CSS selector to select elements using CSS. Let us see an example to return a style property on the first matched element. The css( name ) method returns a style property on the first matched element.Here is the description of all parameter used by this method −name − The name of the property to access.ExampleYou can try to run the following code to learn how jQuery selects elements with CSS:Live Demo jQuery Example $(document).ready(function() { ... Read More
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
181 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.
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
15K+ 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
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
1K+ 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
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
702 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