Skip to main content

Bug Tracker

Side navigation

#8698 closed bug (invalid)

Opened March 29, 2011 07:16PM UTC

Closed March 29, 2011 07:41PM UTC

Bind not firing immediately with 'ready'

Reported by: ErikEckhardt Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (4)

Changed March 29, 2011 07:17PM UTC by ErikEckhardt comment:1

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.

Changed March 29, 2011 07:31PM UTC by timmywil comment:2

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).

Changed March 29, 2011 07:36PM UTC by ErikEckhardt comment:3

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

Changed March 29, 2011 07:41PM UTC by ajpiano comment:4

resolution: → invalid
status: newclosed