<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Multiple $(document).ready()</title>
	<atom:link href="http://www.learningjquery.com/2006/09/multiple-document-ready/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2006/09/multiple-document-ready</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Colin Asquith</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-84727</link>
		<dc:creator>Colin Asquith</dc:creator>
		<pubDate>Tue, 06 Dec 2011 16:39:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-84727</guid>
		<description>js - if you want to create a function that can be used anywhere then create it outside of the document.ready but then call it from inside the document.ready method.</description>
		<content:encoded><![CDATA[<p>js &#8211; if you want to create a function that can be used anywhere then create it outside of the document.ready but then call it from inside the document.ready method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kavya Shetty</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-83660</link>
		<dc:creator>Kavya Shetty</dc:creator>
		<pubDate>Thu, 28 Apr 2011 07:04:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-83660</guid>
		<description>var $j = {};
    $j = jQuery.noConflict(true);

    $j(document).ready(function () {
        $j(&quot;.newsticker&quot;).CarouselLite({
               });

    });
    $j(document).ready(function () {
        $(&#039;.slideshow&#039;).cycle({
            fx: &#039;fade&#039; // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        });
    });</description>
		<content:encoded><![CDATA[<p>var $j = {};<br />
    $j = jQuery.noConflict(true);</p>
<p>    $j(document).ready(function () {<br />
        $j(&#8220;.newsticker&#8221;).CarouselLite({<br />
               });</p>
<p>    });<br />
    $j(document).ready(function () {<br />
        $(&#8216;.slideshow&#8217;).cycle({<br />
            fx: &#8216;fade&#8217; // choose your transition type, ex: fade, scrollUp, shuffle, etc&#8230;<br />
        });<br />
    });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo Ribeiro</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-83286</link>
		<dc:creator>Hugo Ribeiro</dc:creator>
		<pubDate>Wed, 08 Dec 2010 02:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-83286</guid>
		<description>Ok, so here&#039;s my question...
I am also trying to run a function within another, but I am having some(allot) of troubles...
I&#039;ve tryed this way:

&lt;pre&gt;&lt;code&gt; 
$(document).ready(function(){
		
	$(&#039;#navmenu li a&#039;)
		.css( {backgroundPosition: &quot;-235px 0&quot;} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:&quot;(0px 0)&quot;, color:&quot;#eee5e0&quot;}, {duration:500})
		});
	$(&#039;#navmenu li a&#039;).mouseout(function(){
			$(this).stop().animate({backgroundPosition:&quot;(235px 0)&quot;, color:&quot;#963231&quot;}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: &quot;-235px 0&quot;})
			}})
		});
	$(&#039;#navmenu li a&#039;).click( function(){
									   
			var href= $(this).attr(&#039;href&#039;);
			var toLoad= href+&#039; #texto&#039;;
			var titulo = &quot;\&quot;O Artur\&quot;&quot;;
			if(href==&quot;index.php&quot;)
				titulo = &quot;\&quot;O Artur\&quot;&quot;
			else 
				titulo = $(this).text()
			
			$(&#039;#texto&#039;).hide(&#039;normal&#039;,loadContent)
			$(&#039;#load&#039;).remove()
			$(&#039;#conteudo&#039;).append(&#039;LOADING...&#039;)
			$(&#039;#load&#039;).fadeIn(&#039;normal&#039;)
			$(&quot;p#titulo&quot;).fadeOut(&#039;fast&#039;)
			window.location.hash = $(this).attr(&#039;href&#039;).substr(0,$(this).attr(&#039;href&#039;).length-4)
			
			function loadContent() {		
				$(&quot;#texto&quot;).load(toLoad,&#039;&#039;,showNewContent())
				$(&quot;p#titulo&quot;).html(titulo)
				$(&quot;p#titulo&quot;).fadeIn(&quot;normal&quot;)
			}
			function showNewContent() {
				$(&#039;#texto&#039;).show(&#039;normal&#039;,hideLoader())
			}
			function hideLoader() {
				$(&#039;#load&#039;).fadeOut(&#039;normal&#039;)
			}
			return false;
		});		
			
});


$(document).ready(function(){
	$(&quot;#datepicker&quot;).datepicker({ minDate: 0, maxDate: &quot;+1Y&quot; })
		
});
&lt;/code&gt;&lt;/pre&gt;

, and also with the  following code inside the other... like this :
 &lt;pre&gt;&lt;code&gt;
$(document).ready(function(){

(...) 

        $(document).ready(function(){
			$(&quot;#datepicker&quot;).datepicker({ minDate: 0, maxDate: &quot;+1Y&quot; })
		
       });

});
&lt;/code&gt;&lt;/pre&gt;


can anyone tell me what i am doing wrong?

Thank you</description>
		<content:encoded><![CDATA[<p>Ok, so here&#8217;s my question&#8230;<br />
I am also trying to run a function within another, but I am having some(allot) of troubles&#8230;<br />
I&#8217;ve tryed this way:</p>
<pre><code>
$(document).ready(function(){

	$('#navmenu li a')
		.css( {backgroundPosition: "-235px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0px 0)", color:"#eee5e0"}, {duration:500})
		});
	$('#navmenu li a').mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(235px 0)", color:"#963231"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "-235px 0"})
			}})
		});
	$('#navmenu li a').click( function(){

			var href= $(this).attr('href');
			var toLoad= href+' #texto';
			var titulo = "\"O Artur\"";
			if(href=="index.php")
				titulo = "\"O Artur\""
			else
				titulo = $(this).text()

			$('#texto').hide('normal',loadContent)
			$('#load').remove()
			$('#conteudo').append('LOADING...')
			$('#load').fadeIn('normal')
			$("p#titulo").fadeOut('fast')
			window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4)

			function loadContent() {
				$("#texto").load(toLoad,'',showNewContent())
				$("p#titulo").html(titulo)
				$("p#titulo").fadeIn("normal")
			}
			function showNewContent() {
				$('#texto').show('normal',hideLoader())
			}
			function hideLoader() {
				$('#load').fadeOut('normal')
			}
			return false;
		});		

});

$(document).ready(function(){
	$("#datepicker").datepicker({ minDate: 0, maxDate: "+1Y" })

});
</code></pre>
<p>, and also with the  following code inside the other&#8230; like this :</p>
<pre><code>
$(document).ready(function(){

(...) 

        $(document).ready(function(){
			$("#datepicker").datepicker({ minDate: 0, maxDate: "+1Y" })

       });

});
</code></pre>
<p>can anyone tell me what i am doing wrong?</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jere</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-83151</link>
		<dc:creator>jere</dc:creator>
		<pubDate>Fri, 19 Nov 2010 09:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-83151</guid>
		<description>Try like this:
&lt;pre&gt;&lt;code&gt;
var someFunction;
$(document).ready(function() {
     someFunction = function() {
          // some function that does stuff
     };
});

$(document).ready(function() {
     someFunction();
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Try like this:</p>
<pre><code>
var someFunction;
$(document).ready(function() {
     someFunction = function() {
          // some function that does stuff
     };
});

$(document).ready(function() {
     someFunction();
});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex C</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-81779</link>
		<dc:creator>Alex C</dc:creator>
		<pubDate>Fri, 27 Aug 2010 19:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-81779</guid>
		<description>Very nice! Exactly what I was looking for. I need this for a Joomla module which needs to generate some $(document).ready() code but not disturb the static call to the same function elsewhere. Thank you for this great article :)</description>
		<content:encoded><![CDATA[<p>Very nice! Exactly what I was looking for. I need this for a Joomla module which needs to generate some $(document).ready() code but not disturb the static call to the same function elsewhere. Thank you for this great article :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-81758</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sat, 21 Aug 2010 07:14:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-81758</guid>
		<description>I dont get it... can you explain how to get rid of this error in detail? thanks! :)</description>
		<content:encoded><![CDATA[<p>I dont get it&#8230; can you explain how to get rid of this error in detail? thanks! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-79978</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Thu, 08 Apr 2010 01:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-79978</guid>
		<description>Just a guess, but you likely want to use  &lt;a href=&quot;http://api.jquery.com/unbind/&quot; rel=&quot;nofollow&quot;&gt;unbind&lt;/a&gt; to remove the existing event handlers from the elements before you re-run Script A.   Sounds like your elements have multiple handlers for a given event.</description>
		<content:encoded><![CDATA[<p>Just a guess, but you likely want to use  <a href="http://api.jquery.com/unbind/" rel="nofollow">unbind</a> to remove the existing event handlers from the elements before you re-run Script A.   Sounds like your elements have multiple handlers for a given event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tom</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-79886</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Sun, 21 Mar 2010 20:26:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-79886</guid>
		<description>hello, great article.
wanted to ask a solution for the following scenario:
i have a web page containing a div where i can drag and drop elements. On first time load, everything in .ready() in a script(lets call it script A) works great. Now i have another basic option besides the drag and drop to interact with the elements, and a refresh button to refresh the div asynchronously. 
The refresh button fetches all rows from database and places it in the div as draggables, but for them to become draggables, i need to echo script A again just after fetching them.
Now i noticed that after each refresh, some items are firing more than 1 ajax request, as opposed to the first time page load without refreshing. Of course, if i dont &quot;re echo&quot; the script, i dont get draggables.
Any suggestion welcome. Thanks.</description>
		<content:encoded><![CDATA[<p>hello, great article.<br />
wanted to ask a solution for the following scenario:<br />
i have a web page containing a div where i can drag and drop elements. On first time load, everything in .ready() in a script(lets call it script A) works great. Now i have another basic option besides the drag and drop to interact with the elements, and a refresh button to refresh the div asynchronously.<br />
The refresh button fetches all rows from database and places it in the div as draggables, but for them to become draggables, i need to echo script A again just after fetching them.<br />
Now i noticed that after each refresh, some items are firing more than 1 ajax request, as opposed to the first time page load without refreshing. Of course, if i dont &#8220;re echo&#8221; the script, i dont get draggables.<br />
Any suggestion welcome. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dejan</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-79765</link>
		<dc:creator>Dejan</dc:creator>
		<pubDate>Tue, 02 Mar 2010 03:50:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-79765</guid>
		<description>Hi Karl Swedberg. 
I&#039;m noobie in JS and i have already integrated &quot;easySlider&quot; on my site for my photo gallery. 
I found out about &quot;lavalamp&quot; plug in and when i wanted to put it on same page as &quot;easySlider&quot; it&#039;s not working. So on other pages where i don&#039;t have &quot;easySlider&quot; everything is ok. 
I have no idea what to do.

&amp;lt pre &amp;gt &amp;lt code &amp;gt
	$(function() {
            $(&quot;#1, #2, #3&quot;).lavaLamp({
                fx: &quot;backout&quot;, 
                speed: 700,
                click: function(event, menuItem) {
                    return false;
                }
            });
        });
 

  
   $(document).ready(function(){	
			$(&quot;#slider&quot;).easySlider({
				auto: false, 
				continuous: true,
				numeric: true
			});
		});	
 &amp;lt /code &amp;gt &amp;lt /pre &amp;gt

I spended a whole night trying to fix this, but i had no luck (and knowledge as well).

Any suggestion what to do?

Thanks a lot in advance.</description>
		<content:encoded><![CDATA[<p>Hi Karl Swedberg.<br />
I&#8217;m noobie in JS and i have already integrated &#8220;easySlider&#8221; on my site for my photo gallery.<br />
I found out about &#8220;lavalamp&#8221; plug in and when i wanted to put it on same page as &#8220;easySlider&#8221; it&#8217;s not working. So on other pages where i don&#8217;t have &#8220;easySlider&#8221; everything is ok.<br />
I have no idea what to do.</p>
<p>&amp;lt pre &amp;gt &amp;lt code &amp;gt<br />
	$(function() {<br />
            $(&#8220;#1, #2, #3&#8243;).lavaLamp({<br />
                fx: &#8220;backout&#8221;,<br />
                speed: 700,<br />
                click: function(event, menuItem) {<br />
                    return false;<br />
                }<br />
            });<br />
        });</p>
<p>   $(document).ready(function(){<br />
			$(&#8220;#slider&#8221;).easySlider({<br />
				auto: false,<br />
				continuous: true,<br />
				numeric: true<br />
			});<br />
		});<br />
 &amp;lt /code &amp;gt &amp;lt /pre &amp;gt</p>
<p>I spended a whole night trying to fix this, but i had no luck (and knowledge as well).</p>
<p>Any suggestion what to do?</p>
<p>Thanks a lot in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://www.learningjquery.com/2006/09/multiple-document-ready/comment-page-1#comment-79661</link>
		<dc:creator>Bryan</dc:creator>
		<pubDate>Tue, 02 Feb 2010 00:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/multiple-document-ready#comment-79661</guid>
		<description>Hello,
I am a beginner in jQuery and I have been playing around with couple basic jQuery methods.
A question came up when I try to build my test site, the scenario is as follows:
If I have a site that includes only one javacript file, say site.js, and inside the file I have a couple of document.ready function that manipulates different DOM objects e.g.

$(function(){
         //a function for sign_up page
        //change the border color when password field is unfocused
       $(&quot;#password&quot;).blur(function(){
                            $(&quot;#password&quot;).css({&quot;border&quot; : &quot;red solid 3px&quot;});
       });
       
       //other functions 
});

My question would be what if I am not in the page where the password field is present. Will this cause any problem or is this a good style? if not what would be a better approach?</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I am a beginner in jQuery and I have been playing around with couple basic jQuery methods.<br />
A question came up when I try to build my test site, the scenario is as follows:<br />
If I have a site that includes only one javacript file, say site.js, and inside the file I have a couple of document.ready function that manipulates different DOM objects e.g.</p>
<p>$(function(){<br />
         //a function for sign_up page<br />
        //change the border color when password field is unfocused<br />
       $(&#8220;#password&#8221;).blur(function(){<br />
                            $(&#8220;#password&#8221;).css({&#8220;border&#8221; : &#8220;red solid 3px&#8221;});<br />
       });</p>
<p>       //other functions<br />
});</p>
<p>My question would be what if I am not in the page where the password field is present. Will this cause any problem or is this a good style? if not what would be a better approach?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 9/23 queries in 0.007 seconds using disk: basic
Object Caching 373/384 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 14:18:30 -->
