Skip to main content

Bug Tracker

Side navigation

#13305 closed bug (notabug)

Opened January 22, 2013 09:44PM UTC

Closed January 22, 2013 10:30PM UTC

Last modified January 22, 2013 10:40PM UTC

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.

Attachments (0)
Change History (3)

Changed January 22, 2013 10:07PM UTC by waddlesplash comment:1

_comment0: Here's a [http://jsfiddle.net/jeCAN/| 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...1358892442759410
_comment1: Here's a [http://jsfiddle.net/jeCAN/ 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...1358892531631229
_comment2: Here's a [http://jsfiddle.net/5yz3E/ 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...1358892979671680

Here's a jsBin 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...

Changed January 22, 2013 10:30PM UTC by dmethvin comment:2

resolution: → notabug
status: newclosed

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

Changed January 22, 2013 10:40PM UTC by waddlesplash comment:3

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