• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding jquery to a page

 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The syntax is invalid. <script> tags cannot be self-closing.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And yes, the script should be in the head element.
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Convention, and to be sure that it's loaded before the body.
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic