How to Importing jQuery into Joomla?

How to Importing jQuery into Joomla?

New Issue
Joomla Support Stella
  • (1 Ratings)

What's the best way to import jQuery into Joomla? Is there a specific place where the import should be done to use one jquery library site?

Thank you

1 Responses

AppClave

6 years ago #190

Hi,

This is the php code we used on all version of Joomla

Joomla 2.5

if(!JFactory::getApplication()->get('jquery')){
    JFactory::getApplication()->set('jquery',true);
    $document = JFactory::getDocument();
    $document->addScript(JUri::root() . "templates/template_name/js/jquery.js");
}

Joomla 3.x (no conflict mode):

JHtml::_('jquery.framework');

Joomla 3.x (normal mode):

JHtml::_('jquery.framework', false);

You need to insert this code into the index.php of your template 

Best Regards 
AppClave Team

Submit Your Response