- 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
4K+ Views
The code which gets included inside $( window ).on( "load", function() { ... }) runs only once the entire page is ready (not only DOM).Note: 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.ExampleYou can try to run the following code to learn how to use $(window).load() method in jQuery −Live Demo $(document).ready(function(){ $("img").load(function(){ alert("Image successfully loaded."); }); }); Note: 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.
25K+ Views
The ready() method is used to make a function available after the document is loaded. Whatever code you write inside the $(document ).ready() method will run once the page DOM is ready to execute JavaScript code.ExampleYou can try to run the following code to learn how to use $(document).ready() method in jQuery:Live Demo jQuery Function $(document).ready(function() { $("div").click(function() { alert("Hello, world!"); }); }); Click on this to see a dialogue box.
1K+ Views
To initialize jQuery in a web easy is quite easy. You can try to run the following code to learn how to initialize jQuery in a web page. We’re using Google CDN to add jQuery. Microsoft CDN is also available for the same purpose of adding jQuery library to HTML.ExampleLive Demo jQuery Function $(document).ready(function() { $("div").click(function() {alert("Welcome to Tutorialspoint!");}); }); Click on this to see a dialogue box.
512 Views
To add and remove HTML attributes with jQuery, use the addClass() and removeClass() method.You can try to run the following code to add and remove HTML attributes with jQuery −ExampleLive Demo jQuery Example $(document).ready(function(){ $( '#add' ).click( function () { $('#page_navigation1').addClass( 'blue-class' ); }); $( '#remove' ).click( function () { $('#page_navigation1').removeClass( 'blue-class' ); }); }); .blue-class { background-color: blue; font-size: 30px; } Demo Add Remove
962 Views
To remove all the attributes of an HTML element, the removeAttr() method won’t work. For this, create an array and use removeAllAttrs() to remove all the attributes of a specific HTML element. For example, remove the image by removing the attributes of the img element.You can try to run the following code to learn how to remove all the attributes from an element. We’re removing the img element attribute −ExampleLive Demo Selector Example $(document).ready(function() { $(".remove-attr").click(function(){ ... Read More
7K+ Views
To remove an attribute from each tag using jQuery, use the removeAttr() method and use the Universal Selector. Let us see how to use the method to remove all style attribute. Use the universal selector also to select all the elements.You can try to run the following code to learn how to remove all style attributes using jQuery −ExampleLive Demo $(document).ready(function(){ $("button").click(function(){ $("h1").removeAttr("style"); }); }); This is heading This is demo text. This is heading This is demo text. Remove Click above to remove style attribute from all h1 elements.
244 Views
To remove an attribute from each tag using jQuery, use the removeAttr() method. You can try to run the following code to learn how to remove attribute −ExampleLive Demo $(document).ready(function(){ $("button").click(function(){ $("h1").removeAttr("style"); }); }); This is heading This is demo text. This is heading This is demo text. Remove Click above to remove style attribute from all h1 elements.
74 Views
jQuery comes with a lot of methods to manipulate attributes. These are DOM related methods. The attributes include,text() – This method sets or returns the text content of elements selected.html() – This method sets or returns the content of elements selected.val() – This method sets or returns the value of form fields.You can try to run the following code to learn how to manipulate attributes with text() and html() methods −Example $(document).ready(function(){ $("#button1").click(function(){ alert("Using text- " + $("#demo").text()); }); $("#button2").click(function(){ alert("Using html()- " + $("#demo").html()); }); }); This is demo text. Text HTML
739 Views
jQuery effect methods are used to create custom animation effects. The following are some of the methods used to provide effects in jQuery −S.NoMethodDescription1animate()Custom animation on the selected elements2clearQueue()To remove remaining queued functions from the selected elements3delay()To set a delay for all queued functions on the selected elements4dequeue()To remove the next function from the queue, and then executes the function5fadeIn()Fades in the selected elements6fadeOut()Fades out the selected elements7fadeTo()Fades in/out the selected elements to a given opacity8fadeToggle()To Toggle between the fadeIn() and fadeOut() methods9finish()To stop, remove and complete all queued animations for the selected elementsLet’s see an example to work with ... Read More
1K+ Views
To add a class on click of anchor tag using jQuery, use the addClass() method. You can try to run the following code to learn how to implement adding a class on click of anchor tag using jQuery −ExampleLive Demo $(document).ready(function() { $("a").click(function() { $("a.active").removeClass("active"); $(this).addClass("active"); }); }); .active { font-size: 22px; } One Two Click any of the link above and you can see the changes.
To Continue Learning Please Login
Login with Google