I want to my text fade in when page is loaded, i tried with this code-
$(document).on("load", function () {
$("#div1").fadeIn();
});
Why this not working? I'm using 3.1.1
Basically, the most reliable way to check if jQuery has been loaded is to check typeof jQuery — it will return "function" if jQuery was already loaded on the page, or "undefined" if jQuery hasn't been loaded yet.
The load event occurs when a specified element has been loaded. This event works with elements associated with a URL (image, script, frame, iframe), and the window object. Depending on the browser, the load event may not trigger if the image is cached (Firefox and IE).
Use $. ajax instead of . load function. But make sure you specify the dataType as html for the ajax function. .
You should be passing .on("load") on the window
instead of the document:
$(window).on("load", function () {
$("#div1").fadeIn();
});
Alternatively, you could call .ready() on the document:
$(document).ready(function () {
$("#div1").fadeIn();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With