Thursday, 26 February 2009

Implementing Presto 3.0 - Gotcha #3

I stated in an earlier post that I started using JQuery to customise some of the UI elements in Presto. To do this I referenced the latest  copy of the jQuery library from the custom common scripts file. Everything was working fine until I started to get a runtime error when I tried to use the removeAttr function on the home page.  I was calling it to remove an inline style on the search text box.  This function was being called during the document.ready function so, at that point the DOM had been loaded but was yet to be rendered. On looking a little further at the numerous script calls within the page, I noticed that an earlier version (circa 2006!) version of jQuery was being called later in the DOM and this version was overwriting my version declared earlier in the DOM.

jQuery is written to be completely backwards compatible so I had no qualms about emptying the old library file so my jQuery declarations are not being overwritten.

Hey Presto... jQuery is working again.

No comments:

Post a Comment