Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 12652

JavaScript is a dynamically-typed language commonly used for client-side scripting. Unless a tag for a framework/library is also included, a pure JavaScript answer is expected.

2 votes

How can I unload scripts in Joomla 5

You shouldn't. If jQuery is loaded, it's because something is using it. Disabling it may break some functionality. That said, the API for disabling assets is Joomla\CMS\WebAsset\WebAssetManager::disab …
Sharky's user avatar
  • 12k
1 vote
Accepted

Problem with dropdown menu in Joomla 4 site

Your menu is built using Bootstrap's Dropdown component. Its dropdowns are triggered by clicking. You have added some custom that shows the dropdowns on hover. If you want to disable click behavior, r …
Sharky's user avatar
  • 12k
2 votes
Accepted

Joomla 4 custom template not loading web assets

Templates need to be "inheritable" to implicitly load assets from media/templates/[client]/[template] directory. Making a template inheritable allows users to create "child templates" of your template …
Sharky's user avatar
  • 12k
2 votes
Accepted

Joomla layout CSS classes in a view into iFrame

It doesn't work the way you expect because you're using tmpl URL parameter with value messages. What this parameter does is tells is to render the page using the specified template layout. When the gi …
Sharky's user avatar
  • 12k
4 votes

JRequest Method in Joomla 4

Use Joomla\Input\Input class. Instance relevant to the current request can be accessed through the application: use Joomla\CMS\Factory; $controller->execute(Factory::getApplication()->getInput()->get …
Sharky's user avatar
  • 12k
0 votes

How can I sort an unordered list alphabetically by class with JavaScript or PHP?

Use usort() to sort $legend->markers array: usort( $legend->markers, static fn ($a, $b) => $a->locationtype_id <=> $b->locationtype_id );
Sharky's user avatar
  • 12k
0 votes
Accepted

php exclusion in a joomla plugin of the xml sitemap page created by OSMAP

Inside the plugin, right after fetching the document add document type check so it only runs on HTML pages: if ($doc->getType() !== 'html') { return; } Or: if (!$doc instanceof Joomla\CMS\Documen …
Sharky's user avatar
  • 12k
4 votes

How to Fix PHP Deprecated : Factory::getDocument() is deprecated

Use Joomla\CMS\Application\WebApplication::getDocument(). In your code you're already doing this with $app->getDocument().
Sharky's user avatar
  • 12k
2 votes

addScriptDeclaration is not working

You are using onAfterRender event which is not suitable for modifying the document object because this event is triggered after the page has already been rendered. Use onAfterDispatch, onBeforeRender …
Sharky's user avatar
  • 12k
1 vote

How do I add async attribute for scripts?

If you want to add attributes to all scripts, use a system plugin with onBeforeCompileHead event. defined('_JEXEC') or die; use Joomla\CMS\Plugin\CMSPlugin; class PlgSystemExample extends CMSPlugin …
Sharky's user avatar
  • 12k
2 votes
Accepted

Custom module best practices. JS inside template file or not?

Adding JavaScript manually is bad also. You should use Document API instead. You could avoid JS code cluttering your layout file by using Joomla\CMS\Document\Document::addScriptOptions() instead. …
Sharky's user avatar
  • 12k
1 vote
Accepted

was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)

This most likely means that you are adding non-existing assets. Their links generate a 404 page which is why you're getting the text/html MIME type instead of respective types for CSS/JS files.
Sharky's user avatar
  • 12k
5 votes
Accepted

How to use HTMLHelper to add to the document head

1) JHtml is an alias for Joomla\CMS\HTML\HTMLHelper class. You'll have to start using the real class sooner or later because the alias will not exist in Joomla! 5.0. To use the real class you have to …
Sharky's user avatar
  • 12k
1 vote
Accepted

How to pass a php array to javascript array/object with non-sequential keys

Don't wrap JSON-encoded values in quotes. var roster = <?php echo json_encode($roster, true); ?>;
Sharky's user avatar
  • 12k
2 votes
Accepted

How to submit JForm form based on custom dropdown list value change

onchange attribute can be added to the fields in your XML form. E.g. this is used in filter forms: <field name="access" type="accesslevel" label="JOPTION_FILTER_ACCESS" description="J …
Sharky's user avatar
  • 12k