Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

$(window).load doesn't work with hosted Jquery?

Recommended Posts

I'm using $(window).load to set the visibility of my 'container' div back to visible again once all DOM has been loaded. This works when I'm using a downloaded copy of jquery. But when I use the Google hosted version it's not? That's what I've found out anyway. Or perhaps I'm doing something wrong? I've shortened my test code to below

<!DOCTYPE html>

	<div id="container">

	<!-- Jquery -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>	

		$(window).load(function() {



It should show an alert box when all is loaded, but it doesn't when I open the html. It does however open an alert box when I use $(window).ready instead. @(window).load does work when I reference a local Jquery library file. So is there a reason it doesn't work when I use a Google hosted version instead?

Share this post

Link to post
Share on other sites

Hello jiggy1965, and Welcome to the GreenSock Forum!


Keep in mind that jQuery has deprecated the load() method since version 1.8 and removed it from jQuery version 3.0.




So if your using jQuery version 3.0 or higher you can no longer use the load() method.


You can either try and use the on() method or bind() method. The on() method is good if your element might not be there when the page loads so jQuery can keep listening for your element.

// using the on() method
$(window).on("load", function() {

// or use bind() method
$(window).bind("load", function() {

// but i would make sure the DOM is ready first before checking if the window is loaded

   $(window).on("load", function() {


Happy Tweening? :)

  • Like 3

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.