jportela: (Default)
jportela ([personal profile] jportela) wrote in [site community profile] dw_dev_training2010-07-14 07:27 pm
Entry tags:

Best way to add jQuery to a page

I've been trying to add jQuery support to the poll pages, and I want to know the best way to do this.

I tried to use

LJ::need_res('js/jquery/jquery-1.3.2.min.js');

in cgi-bin/LJ/Poll.pm render method, and doing this did include the jquery library (at least by navigating the source code, the <script> tag was there). However, it appears that I can't use it in htdocs/js/livejournal.js (I wanted to use the initPolls function, to change the submit event on polls), there seems to be a conflict and the script crashes the first time a $ (jquery) is used.

One way around this would be not use the jQuery library at all, but that would mean I would have to serialize the form myself (not very hard, but the jquery implementation would probably be the best).

Please share your thoughts on this, I may be including the jquery library in a very unorthodox way :)

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting