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 :)
kareila: (Default)

[personal profile] kareila 2010-07-15 01:03 am (UTC)(link)
I think [personal profile] fu will have an answer for you, but she's traveling right now, so you might want to PM her.