- 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
![Anjana](https://www.tutorialspoint.com/assets/profiles/13774/profile/60_78029-1512648681.jpg)
169 Views
ExampleLive Demo $("a").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); TOP OF PAGE 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 ... Read More
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
264 Views
When you will begin working about jQuery, you will get to know about the usage of the $ sign. A $ sign is used to define jQuery.jQuery variables begin with $ to distinguish them from a standard JavaScript object. Also, it is a convention. jQuery selectors start with the dollar sign and parentheses() − $.Let's take an Example −// jQuery object var $phone = $("#myphone"); // dom object var phone_el = $("#myphone").get(1);
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
2K+ Views
It’s always a good practice to add jQuery code in footer i.e. just before the closing tag. If you have not done that, then use the defer attribute.Use defer attribute so the web browser knows to download your scripts after the HTML downloaded −The defer attribute is used to specify that the script execution occurs when the page loads. It is useful only for external scripts and is a boolean attribute.ExampleThe following code shows how to use the defer attribute − The external file added will load later, since we're using defer
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
6K+ Views
Create an external JavaScript file and add the jQuery code in it.ExampleLet’s say the name of the external file is demo.js. To add it in the HTML page, include it like the following − Hello Above we added jQuery using Google CDN and the external file was included after that.Add jQuery code in demo.js, since you wanted to place jQuery code −$(document).ready(function(){ alert(“amit”) });
![Srinivas Gorla](https://www.tutorialspoint.com/assets/profiles/13556/profile/60_78057-1512712331.jpg)
81 Views
jQuery is a fast and concise JavaScript Library created by a John Resig in 2006 with a nice motto − Write less, do more.jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.Here is the list of important core features supported by jQuery:DOM manipulation − jQuery made it easy to select a DOM elements, traverse them and modifying their content by using a cross-browser open source selector engine called as Sizzle.Event handling − The jQuery offers an elegant way to capture a wide variety of events, such as a user clicking on a link, without ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
127 Views
The SAPUI5 framework is the original version of the SAP toolkit which was released initially. This version of the toolkit is a proprietary version. Later SAP released an Open source version of it named OpenUI5. Functionally it is almost equivalent in terms of basic operations negating few features but overall sufficient enough as a UI framework.This UI5 framework (applies to both SAPUI5 and OpenUI5) is capable of dispensing all major tasks expected from a full-fledged UI framework. It supports following features:Model View Controller architectureRouting engineModules with the help of module loadersFull data binding either in XML, JSON or using web servicesCulture ... Read More
![David Meador](https://www.tutorialspoint.com/assets/profiles/13351/profile/60_165994-1512670078.jpg)
1K+ Views
The jQuery.extend() method is used to merge contents of two or more objects together. The object is merged into the first object. You can try to run the following code to learn how to use extend() method −ExampleLive Demo $(document).ready(function() { $("#button1").click(function() { var obj1 = { maths: 60, history: {pages: 150,price: 400,lessons: 30}, science: 120 }; var obj2 = { history: { price: 150, lessons: 24 }, economics: 250 }; $.extend(true, obj1, obj2); $("#demo").append(JSON.stringify(obj1)); }); }); Result
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
728 Views
$(window).load()Use $(window).load(), when you want the code inside it to run only once the entire page is ready (not only DOM). It executes when the page is fully loaded, including frames, objects and imagesNote: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before 3.0.$(document).ready()Use the $(document).ready() method when you want the code inside it to run once the page DOM is ready to execute JavaScript code.
![David Meador](https://www.tutorialspoint.com/assets/profiles/13351/profile/60_165994-1512670078.jpg)
1K+ Views
To iterate over arrays and objects in jQuery, use the jQuery forEach() loop. You can try to run the following code to learn how to iterate over arrays and objects −ExampleLive Demo $(document).ready(function(){ $("#button1").click(function(){ var arr = [{subject: "Maths", id:3}, {subject: "History", id:7}]; arr.forEach(function(el, index) { alert(el.id+" "+el.subject); }); }); }); Result
![Ricky Barnes](https://www.tutorialspoint.com/assets/profiles/13354/profile/60_84969-1512590781.jpg)
3K+ Views
To trim a string in jQuery, use the trim() method. It removes the spaces from starting and end of the string.The sample string I am using has spaces −var myStr = " Hello World ";Use the trim() method, jQuery.trim(myStr);The following is an example to trim a string in jQuery −ExampleLive Demo $(document).ready(function(){ $("#button1").click(function(){ var myStr = " Hello World "; myStr = jQuery.trim(myStr); alert(myStr); }); }); Trim