| Author |
Adding jquery to a page
|
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
Hello all,
I have HTML page which contains some javascript functions , now I try to include jquery.js file in this page. I'm not adding this in the head of the HTML.But when i add this, the whole page is not displayed.
I remove the include, and the page is rendered again. Is jquery working on the HTML elements on page load? Or should it be always added to the head of the HTML doc?
Thanks,
Srikkanth
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
The syntax is invalid. <script> tags cannot be self-closing.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
And yes, the script should be in the head element.
|
 |
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
Thanks for pointing out the mistake Bear. I changed it to this, and now it is working. But why do you say it should be in the HEAD?
Thanks,
Srikkanth
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
|
Convention, and to be sure that it's loaded before the body.
|
 |
Srikkanth Mohanasundaram
Ranch Hand
Joined: Feb 07, 2007
Posts: 185
|
|
|
Thanks a lot for your help
|
 |
 |
|
|
subject: Adding jquery to a page
|
|
|