Forum Moderators: open

Message Too Old, No Replies

How to separate Javascript to specific pages?

         

toplisek

8:49 am on Jul 3, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have set Javascript code to load for each page like:

jQuery(document).ready(function()
{
Mypage1.initMap();
Mypage2.initMap();
}
);
</script>


Should be included for the specific page or all pages can have the same code?

Example:
Mypage1 will have only

{
Mypage1.initMap();
}
);
</script>


or all pages can have


jQuery(document).ready(function()
{
Mypage1.initMap();
Mypage2.initMap();
}
);
</script>

incrediBILL

4:58 am on Aug 5, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Guess you didn't supply enough data to form an opinion

I assume you're loading Google maps?

What about initializing based on the page name so you can have all the code on the page and it does something different based on which page name you're currently viewing.