JSP Document (JSPX) Page does not run JQuery
Posted on 2009-07-10
I have a web page, served by Tomcat, that's written using JSPX. The page contains a number of <div>s, each of which are hidden when it first loads. When the user clicks any of a number of different hyperlinks in the page, a JQuery function is executed to create a lightbox effect with the corresponding hidden <div> (essentially, each div can be displayed as a popup window).
However, when the page loads the <div>s are all visible, and nothing works. I'm getting a number of JQuery errors indicating that the browser had found problems within the main JQuery library code itself ("this._hide is undefined", "div.style is undefined").
What's extremely strange about this is that the JSP version of the page (that is, the non-XML version) works perfectly without any errors.
My initial assumption is that the DOM for a JSPX page is built in a different manner than one for a JSP page. Alternatively, perhaps this is something to do with the way JQuery works - I've noticed that if I reorder the various JQuery UI library file <script> entries within the page, the error changes, indicating that the function is executing before the rest of the libraries are loaded or the page is completely built.
But honestly, I've no idea. Any takers?
I will post code if necessary, but if someone can get a JSPX page that does something similar using JQuery working on Tomcat 6, that would be a start.
Thanks in advance!