Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13305 closed bug (notabug)

jQuery does not run SPECIFIC code in second $(document).ready()

Reported by: waddlesplash Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:

Description

In jQuery 1.9.0, I have the following two $(document).ready() functions:

$(function() {
  $('.dropdown-toggle').dropdown(); // twitter bootstrap
});

Between the two, there are </script> and <script> tags and numerous other tags in between. And I need these two to be in the different locations that they are, and in two separate <script> tags.

$(function() {
        $('#load').hide();
        $('#ok').hide();
        $('#bad').hide();
  
        $("#user").focusout(function() {
                alert("I got here!");
                /* the above code never runs... */
        });
});

All code in both except for the $("#user").focusout runs. If the first $(document).ready() is commented out, THEN the $("#user").focusout runs. But not otherwise.

Change History (3)

comment:1 Changed 6 years ago by waddlesplash

Here's a jsFiddle with all JS files included. The addition of bootstrap.js is what seems to break this, why? Everything else works. This still appears to be jQuery's problem as the addition of a plugin should not break this...

Version 2, edited 6 years ago by waddlesplash (previous) (next) (diff)

comment:2 Changed 6 years ago by dmethvin

Resolution: notabug
Status: newclosed

You can't quick-close <script /> tags. The script block is eaten by that.

comment:3 in reply to:  2 Changed 6 years ago by waddlesplash

Whoops. But that was just for jsBin, my real <head> code does not have that.

For some reason, it all now works in both places (without any changes from me in the desktop part). I hate bugs that fix themselves, so I may be back if it somehow reappears...

Note: See TracTickets for help on using tickets.