0
Hello! I searched everything that was singing and couldn’t find a step-by-step how to use Jquery in Joomla 3.8. I am creating a module and I would like to use Jquery.
I made it here:
1 - download jquery-3.3.1.js and put it in the folder: /modules/mod_mymodule/js
Reading the Joomla documentation, I added the following lines to my modules/mod_mymodule/mod_mymodule.php file:
JHtml::script(JURI::base() . 'js/jquery-3.3.1.js'); Jhtml::_('jquery.framework'); Jhtml::_('jquery.ui');
At the bottom of my default.php file I added this:
<?php $document = JFactory::getDocument(); $document->addScriptDeclaration(' window.event("domready", function() { alert("An inline JavaScript Declaration"); }); '); ?>
It should show an alert window when the page loads but does not work. What I am doing wrong?
Ten try to change
window.event("domready", function() {
 alert("An inline JavaScript Declaration");
 });
for$(function() {
 alert("An inline JavaScript Declaration");
 });
– Guilherme Nascimento
But nothing happens doing it this way.
– Manuela Bittencourt
Take a look at that answer, it’s for an older version of Joomla, but I believe it might work for you! You have two options how to do this https://answall.com/questions/351739/inserindo-javascript-na-header-do-joomla-2-5-8/351849#351849
– hugocsl