Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- How does this code run?


daveVk - 1:58 am on Oct 28, 2012 (gmt 0)


Keep the style declaration in the head section.

If there is existing style declaration add line "html.js-on #method1 {color:red;}" to it will suffice.

I already have jquery library on the page

Then do no include include it a second time with
<script type="text/javascript" src="jquery.js"></script>

When a statement like:
<script type="text/javascript" src="jquery.js"></script>
is included in head section, page load is delayed until jquery.js is loaded.

To reduce delay it can be placed at end of body. If you do that, script like
$('html').addClass('js-on'); will need to be moved also as it relies on jquery.js being loaded.

So if you decide to put script in body, you will need to consider all script on page, and possibly move it all.


Thread source:: http://www.webmasterworld.com/javascript/4512050.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com