| More on using jQuery with Joomla |
| technical |
| Wednesday, 14 April 2010 19:58 |
|
I recently received an email from Hugo asking me for some advice on using jQuery with Joomla. He writes:
First off: I'm not familiar with the asmSelect form. (That said, I'll be sure to add it to my already-too-long 'stuff-to-check-out' list.) Therefore, my advice is generic at best. I don't have time to write up a full tutorial on how to incorporate that specific jQuery-based product into Joomla, but I think I can help give some suggestions on the path to follow and where/how to find the specific information you'll need to get there.
Just like any usage of jQuery, you need to reference the main jQuery script prior to your own scripts, preferably in the document's head. However, just like any JS application, you don't have to limit the scripts to the head. That usually means editing or creating your own template. Remember, Joomla uses MooTools, which also uses the There's also a great Joomla plugin that adds jQuery and jQuery UI to your head automatically, as well as a Ultimately, the exact way in which you incorporate your use of jQuery into your Joomla site will really depend on several factors, including:
In other words, your mileage may vary. Finally, in the interest of full-disclosure, keep this in mind: in my day job, I don't use Joomla at all, or even PHP. In my day job, we work in old-school ASP with a custom database-driven application, and I pretty much work mostly on front-end architecture. And I use jQuery exclusively as my only JS library at the day-job, so I don't have to worry about using .noConflict(). Because of all this, I don't spend much time doing development for Joomla... I'll use jQuery in building templates to add interactivity to my modules, but incorporating jQuery into specific articles, modules, or other extensions just hasn't really been on my radar yet. All that said, I do use jQuery enough to have a pretty good idea on what's involved. Good luck, and I look forward to seeing how everyone incorporates jQuery into their Joomla sites. Cheers! |