"However, I assume if I do this in two different .js files, the second
one will
replace the first one"

and your assumption is not correct....

<---- javascript1.js ----->
$(window).load(function() {
     alert("Alert in One");
});
<------------------------------>

<---- javascript2.js ----->
$(window).load(function() {
     alert("Alert in Two");
});
<------------------------------>


should give you two alert  boxes






On Jan 13, 11:41 am, Krommenaas <krommen...@gmail.com> wrote:
> I'm relatively new to jQuery and ran into a problem. I use a framework
> (CakePHP) and want some of my jQuery to be included by the layout (the
> general template for the site) and some by the current view (which is
> page specific). This means the actual html page will use two (or
> more) .js files.
>
> I need to put everything in $(window).bind('load', function () {}  to
> make sure my jQuery is executed after loading all images. However, I
> assume if I do this in two different .js files, the second one will
> replace the first one. So the question: how can I use $(window).bind
> ('load', function () {} in multiple .js files?

Reply via email to