- 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
119 Views
The last() method in jQuery is used to return the last element of the selected elements.SyntaxThe syntax is as follows −$(selector).last()ExampleLet us now see an example to implement the jQuery last() method − Live Demo $(document).ready(function(){ $("div p").last().css("color", "orange"); }); Demo Heading This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. OutputThis ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
The keyup() method in jQuery is used to trigger the keyup event. It occurs when the keyboard key is released.SyntaxThe syntax is as follows −$(selector).keyup(func)ExampleLet us now see an example to implement the jQuery keyup() method− Live Demo $(document).ready(function(){ $("input").keydown(function(){ $("input").css("color", "red"); }); $("input").keyup(function(){ $("input").css("color", "blue"); }); }); Registeration Enter username of the student: Username: OutputThis will produce the following output −Now, when a keyboard key is pressed down (on ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
387 Views
The keypress method in jQuery is used to trigger the keypress event. It occurs when a keyboard key is pressed down.SyntaxThe syntax is as follows −$(selector).keypress(func)ExampleLet us now see an example to implement the jQuery keypress() method− Live Demo count = 0; $(document).ready(function(){ $("input").keypress(function(){ $("span").text(count += 1); }); $("input").keyup(function(){ $("input").css("color", "blue"); }); }); Registeration Enter username of the student: Username: Key is pressed 0 times. OutputThis will produce the following output−Now, when the key is pressed, the count of the number of keys appeared−
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
559 Views
The mousemove() method in jQuery is used to trigger the mousemove event. It occurs whenever the mouse pointer moves within the selected element.SyntaxThe syntax is as follows−$(selector).mousemove(func)ExampleLet us now see an example to implement the jQuery mousemove() method− Live Demo $(document).ready(function(){ $("h2").mouseenter(function(){ $("h2").css("color", "red"); }); $("h2").mouseleave(function(){ $("h2").css("color", "blue"); }); $("h2").mousemove(function(event){ $("p").text("x = "+event.pageX + ", y = " + event.pageY); }); }); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
278 Views
The mouseleave() method in jQuery is used to trigger the mouseleave event. It occurs when the mouse pointer leaves the selected element.SyntaxThe syntax is as follows −$(selector).mouseleave(func)ExampleLet us now see an example to implement the jQuery mouseleave() method− Live Demo $(document).ready(function(){ $("h2").mouseenter(function(){ $("h2").css("color", "red"); }); $("h2").mouseleave(function(){ $("h2").css("color", "blue"); }); }); Demo Heading OutputThis will produce the following output−Keep the mouse cursor on the text (mouse enter) and the text color will ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
269 Views
The mouseenter() method in jQuery is used to trigger the mouseenter event. It occurs when the mouse pointer enters the selected element.SyntaxThe syntax is as follows−$(selector).mouseenter(func)ExampleLet us now see an example to implement the jQuery mouseenter() method− Live Demo $(document).ready(function(){ $("h2").mouseenter(function(){ $("h2").css("color", "red"); }); $("h2").mouseleave(function(){ $("h2").css("color", "blue"); }); }); Demo Heading OutputThis will produce the following output −Keep the mouse cursor on the text (mouse enter) and the text color will change −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
165 Views
The hasClass() method in jQuery is used to check if any of the selected elements is having a specified class name.SyntaxThe syntax is as follows −$(selector).hasClass(classname)Above, the parameter class name is the class name to search for in the selected elements.ExampleLet us now see an example to implement the jQuery hasClass() method− Live Demo $(document).ready(function(){ $("button").click(function(){ alert($("h2").hasClass("demo")); }); }); Student Info Teacher Info Click me OutputThis will produce the following output− Click the “Click me” button to display whether any element has class “demo”:
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
175 Views
The has() method in jQuery is used to return elements having one or more elements inside them, that matches the specified selector.SyntaxThe syntax is as follows−$(selector).has(ele)Above, the parameter ele is used to specify a selector expression or an element to match elements against.ExampleLet us now see an example to implement the jQuery has() method − Live Demo $(document).ready(function(){ $("button").click(function(){ $("p").has("span").css("color", "orange"); }); }); h2 { color: blue; } Student Info This is a demo text. Exam Info This is ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
348 Views
The resize() method in jQuery is used to trigger the resize event. It occurs when the browser window changes size.SyntaxThe syntax is as follows −$(selector).resize(func)Above, the parameter func is used to specify the function to run when the resize event is triggeredExampleLet us now see an example to implement the jQuery resize() method− Live Demo var count = 0; $(document).ready(function(){ $(window).resize(function(){ $("span").text(count += 1); }); }); span { padding: 10px; border: 3px dashed orange; font-size: 20px; } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
104 Views
With jQuery, you can easily find siblings of an element using the following methods: next(), nextAll(), prev(), prevAll(), siblings(), etc. Let us see some of them traverse siblings−next() methodThe next() method is used to return the next sibling element of the selected element. Let us see an example−Example Live Demo div { width:600px; } .demo * { display: block; border: 2px solid orange; color: blue; padding: 10px; margin: 10px; } $(document).ready(function(){ $("h3").next().css({"color": "gray", "border": "3px dashed blue"}); }); parent sibling ... Read More