Bug Tracker

Ticket #8698 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Bind not firing immediately with 'ready'

Reported by: ErikEckhardt Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description

This works as expected, calling the function immediately if the ready event has already passed:

$(document).ready(function() {alert('hi');});

But this does not work in my web page on page reload:

$(document).bind('ready.label', function() {alert('hi');});

On my initial page launch it works (most likely because the ready event hasn't "fired" yet?). But on reload, when stuff happens faster because nothing has to be re-downloaded, it just sits there and stares at me. I am using FireFox 3.6.16.

I created a  jsFiddle for this, but it doesn't have the problem, most likely because the page is too simple. I put the source of the iframe from jsFiddle into a static html page on my web server and reloads always worked fine. So that is no help to figuring out the problem, sorry about that.

However, please believe me that my application does not work on reload when I use bind and it DOES work when I use ready, the ONLY change between working and not working.

Change History

comment:1 Changed 3 years ago by ErikEckhardt

Note: in my web page I am not just doing a simple alert. It is a complex ajax application that loads a bunch of content dynamically.

comment:2 Changed 3 years ago by timmywil

The problem with using .bind('ready') has been documented. See  http://api.jquery.com/ready at the bottom of the initial description. It is recommended that you use $(document).ready(handler) or $(handler).

comment:3 Changed 3 years ago by ErikEckhardt

My apologies if I wasted anyone's time! Please close the ticket.

comment:4 Changed 3 years ago by ajpiano

  • Status changed from new to closed
  • Resolution set to invalid
Note: See TracTickets for help on using tickets.