David Meador has Published 164 Articles

What is the difference between $(window).load() and $(document).ready() functions in jQuery?

David Meador

David Meador

Updated on 13-Jun-2020 11:54:24

3K+ Views

Both the methods are used in jQuery. Let’s see what purpose they fulfill.$(window).load()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 ... Read More

What are the methods used to provide effects in jQuery?

David Meador

David Meador

Updated on 12-Jun-2020 13:09:08

749 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 ... Read More

How can I select an element by its class name using jQuery?

David Meador

David Meador

Updated on 12-Jun-2020 12:40:18

582 Views

The element class selector selects all the elements which match with the given class of the elements. Use the css() method to change the background color.You can try to run the following code to learn how to select an element by its class name using jQuery:Live Demo     ... Read More

How can I select an element with multiple classes in jQuery?

David Meador

David Meador

Updated on 12-Jun-2020 12:31:14

541 Views

To select an element with multiple classes, do the following. Here, x, y, and z are our classes, $('.x.y.z')You can try to run the following code to learn how to select an element with multiple classes in jQuery:Live Demo           jQuery Selector Example       ... Read More

How to call a jQuery library function?

David Meador

David Meador

Updated on 12-Jun-2020 07:16:50

2K+ Views

Calling a JavaScript library function is quite easy. You need to use the script tag. As almost everything we do when using jQuery reads or manipulates the document object model (DOM), we need to make sure that we start adding events etc. as soon as the DOM is ready.If you ... Read More

How to add display:none in an HTML element using jQuery?

David Meador

David Meador

Updated on 17-Feb-2020 10:05:49

3K+ Views

To workaround with display: none in an element in jQuery, use the hide() method. It will do the same work.ExampleYou can try to run the following code to learn how to add display:none in an HTML element −Live Demo $(document).ready(function(){   $("button").click(function(){     $("p").removeAttr("style").hide();   ... Read More

How to toggle a div visibility using jQuery?

David Meador

David Meador

Updated on 17-Feb-2020 10:04:26

7K+ Views

To toggle a div visibility in jQuery, use the toggle() method. It checks the div element for visibility i.e. the show() method if div is hidden. And hide() id the div element is visible. This eventually creates a toggle effect.The toggle( speed, [callback]) method toggles displaying each of the set ... Read More

What is the difference between error () and ajaxError() events in jQuery?

David Meador

David Meador

Updated on 17-Feb-2020 09:56:32

172 Views

jQuery error() methodThe error() method triggers the event when an element encounters an error. This method deprecated in jQuery 1.8.ExampleYou can try to run the following code to learn how to work with error() method in jQuery −Live Demo $(document).ready(function(){     $("img").error(function(){       ... Read More

How to include multiple js files using jQuery $.getScript() method?

David Meador

David Meador

Updated on 17-Feb-2020 09:54:08

500 Views

To use multiple js files, use the same getScript(), which is used to add a single js file. We’re having result.js file with the following code snippet −function CheckJS(){    alert("This is JavaScript - File1"); }We’re having result2.js file with the following code snippet −function CheckJS(){    alert("This is JavaScript ... Read More

How to detect eventType in jQuery?

David Meador

David Meador

Updated on 17-Feb-2020 09:48:11

115 Views

To detect the eventType in jQuery, use the event type property. You can try to run the following code to learn how to detect eventType in jQuery −ExampleLive Demo  $(document).ready(function(){     $("p").on("mouseover mouseout", function(event){         $("div").html("Event Type: " + event.type);     ... Read More

Previous 1 ... 7 8 9 10 11 ... 17 Next
Advertisements