jQuery on page load event not working

0 votes

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

Jun 20, 2022 in JQuery by gaurav
• 23,260 points
1,386 views

1 answer to this question.

0 votes

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();
});
answered Jun 20, 2022 by rajatha
• 7,640 points

Related Questions In JQuery

0 votes
1 answer

why $(window).load() is not working in jQuery?

This event works with elements associated with ...READ MORE

answered Jun 21, 2022 in JQuery by rajatha
• 7,640 points
1,945 views
0 votes
1 answer

Error:jQuery scrollTop not working in Chrome but working in Firefox

Hello @kartik, If your CSS html element has the following overflow markup, scrollTop will ...READ MORE

answered May 29, 2020 in JQuery by Niroj
• 82,880 points
13,984 views
0 votes
1 answer

jquery timepicker cdnjs.cloudflare does not working

jQuery Timepicker can parse the most used ...READ MORE

answered Jun 1, 2022 in JQuery by Edureka
• 13,670 points
1,100 views
0 votes
1 answer

Show Page Loading Spinner on Ajax Call in jQuery Mobile

 Use the ajaxStart() and ajaxStop() Method While working ...READ MORE

answered Jun 10, 2022 in JQuery by gaurav
• 23,260 points
1,187 views
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
512 views
0 votes
1 answer

Is 'sparkline' a method?

I suggest you to check 2 things That jquery.sparkline.js is actually ...READ MORE

answered Nov 9, 2018 in Apache Spark by Frankie
• 9,830 points
986 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,510 points
973 views
0 votes
1 answer

Error: Global Variable is not accessable to local function

Hey kartik, A variable declared outside a function has a ...READ MORE

answered Feb 19, 2020 in PHP by Niroj
• 82,880 points
826 views
0 votes
1 answer

jQuery Animate not working on background-color property

The background color animate can be performed ...READ MORE

answered Jun 16, 2022 in JQuery by rajatha
• 7,640 points
505 views
0 votes
1 answer

How to focus on a form input text field on page load using jQuery?

In this example the form input text ...READ MORE

answered Jun 21, 2022 in JQuery by rajatha
• 7,640 points
1,812 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP