What is jQuery and how do i use it in Joomla?

30. Dezember 2013

Introduction

jQuery is not a language, but it is a well written JavaScript code. As quoted on official jQuery website, „it is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development“.

What is jQuery?

jQuery is not a language, but it is a well written JavaScript code. As quoted on official jQuery website, „it is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.“

In order to work with jQuery, you should be aware of the basics of JavaScript, HTML and CSS.

Why jQuery?

jQuery is very compact and well written JavaScript code that increases the productivity of the developer by enabling them to achieve critical UI functionality by writing very small amount of code.

It helps to improve the performance of the application

It helps to develop most browser compatible web page

It helps to implement UI related critical functionality without writing hundreds of lines of codes

It is fast

It is extensible – jQuery can be extended to implement customized behavior

Other advantages of jQuery are:

No need to learn fresh new syntaxes to use jQuery, knowing simple JavaScript syntax is enough

Simple and cleaner code, no need to write several lines of codes to achieve complex functionality

How to use jQuery in Joomla?

jQuery usually comes as a single JavaScript file containing everything comes out of the box with jQuery. It can be included within a web page using the following mark-up:

<script type="text/javascript" src="jQuery-1.9.1-min.js"></script>

Ideally, this markup is kept in under <head></head> tag of your web page, however you are free to keep anywhere you want. In Joomla you need to search the „index.php“ in your Template Folder and add this before the <jdoc:include type=“head“ /> Tag.