Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript]

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.

10
votes
2answers
2k views

How to render System Message from AJAX call

I would like to display a system message when I got back my ajax request. The ajax request returns the right message. I can test it with an alert. alert(result.message); Joomla.renderMessages(result....
9
votes
1answer
7k views

Add JavaScript with $doc->addScript with async=“true”

is it possible to use the addScript with async="true"? I found a hack that uses some clever quoting to trick the embed function, but it seems as if this could be a native feature: $doc->addScript(...
8
votes
3answers
1k views

Optimizing frontend load, how do I properly combine and compress my JS?

My website for an enterprise client has approximately 90 assets that download on load, 35 or so are JS files. Even "optimizing" extensions that are made for Joomla only seem to get me down to 31 or ...
8
votes
6answers
6k views

Adding javascript file in the footer & custom styles

For fast page load I need to insert JS at the end of the page from components and modules. The following way of declaring scripts does not work to insert it at the bottom because there is no ...
6
votes
2answers
567 views

Control order of loaded scripts

Unfortunatelly I can't register on the joomla forum, so I'll try my best here. Please help, is there any way to control the order of loaded scripts. Example: in my template's index.php I do: $...
6
votes
2answers
382 views

What are the JS dependencies of the Joomla frontend editor?

The Problem I'm trying to implement a functioning frontend editor within my Joomla template which has been developed in-house at my company. For the most part it works - a user can make basic text ...
5
votes
1answer
2k views

How to manage language variables inside javascript

In my custom component I do a lot of javascript validation for each view. The validation throws various error messages and those messages are configured inside the language file en-GB.com_mycomp.ini ...
5
votes
2answers
2k views

Unsetting javascript added to head data by ->addScriptDeclaration() in template

I'm trying to unset all javascript declarations in the document head. By this I mean inline javascript that is added by 3rd party extensions using ->addScriptDeclaration(), and not javascript files ...
5
votes
2answers
786 views

Get access to php variable in Joomlas addscriptdeclaration for Javascript

How do I get access to php variables in Joomlas approach to integrate Javascripts with addScriptDeclaration? $document = JFactory::getDocument(); $variable = "test"; $document->...
5
votes
3answers
1k views

Load javascript script before </body> closing tag

I'm using $doc->addScript($path.'/js/script.js'); to load a Javascript file inside the head section. Is there any native way to load it in the bottom of the page, before the closing </body> ...
4
votes
2answers
404 views

How to load a page with a System Message

How can I load a page with a system message? Specifically I have a link and I would like that when a user clicks on the link it opens a specific page with a system message I pass it. I can see ...
4
votes
2answers
641 views

how to display message in joomla using javascript

I want to display a message after clicking a button in Joomla using: Joomla.renderMessages({"success":"this is test message"}); but it displays the characters vertically and in descending order, ...
4
votes
1answer
225 views

Where to call for CSS/JS in custom component for frontend views

I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. Working with J! 3.6.5 and a MVC ...
4
votes
1answer
235 views

How to use joomla language in a script?

I'm developing a module, in my template (MyModule/tmpl/default.php) I'm able to bring my language string to my script by doing this : <script type="text/javascript"> Mymodule.options.mydz = {...
3
votes
4answers
2k views

Dynamic JS and CSS combining without JCH Optimize

I know JCH Optimize is a very good plugin to compress and minify JS and CSS files but I noticed it also adds time to the page to be rendered. For example, WITHOUT JCH OPTIMIZE my TTFB is 200ms but ...
3
votes
3answers
232 views

How to check JSESSION in javascript

I am developing a component and I use ajax calls to do some tasks in the frontend. I have come to a problem when the session is expires and I don't want to use keepalive to solve it. In the frontend ...
3
votes
6answers
694 views

What's the correct way of adding code after the start of the body tag?

So, I've just recently added the Facebook Javascript SDK to my site to be able to enable a "like" button to my pages. Facebook recommends adding this right after the opening <body> tag. The ...
3
votes
2answers
3k views

Create custom module with javascript .js

I want to create a custom module to insert this .js javascript into my joomla site; joomla 3.x version http://bigspaceship.github.io/shine.js/ how can I do to create my custom text to appear into a ...
3
votes
2answers
3k views

Email address being protected from spambots

I've only noticed this issue on one of my sites. I recently upgraded it from 2.5 to 3.4 On certain (k2 contact) pages where there is an email address displayed I am seeing this right beside the email;...
3
votes
1answer
889 views

How to detect the current site/frontend language within Javascript

I want to detect the current site/frontend language within Javascript. How can I do to register the language for use within?
3
votes
1answer
525 views

Content Modal Popup fails due to Javascript error

Using my own answer for What is best approach to show the component page in popup-modal window without header and footer?, I mentioned that I was getting JS errors, so when as I further investigate, ...
3
votes
1answer
1k views

How to hide/show input fields in form?

Good Day guys, I have this code right here in javascript on hiding/showing an input field: function HideShow() { var Type = document.getElementById("jform_subscription_type"); if(Type.value=...
3
votes
1answer
477 views

Placing inline javascript into the head tags of one page only

I'm using the Sourcerer extension to send script to my header tags on specific pages to comply with the new gtag requirements of placing conversion tags in the head tags of pages that you want to ...
3
votes
2answers
434 views

Save Dynamic Array of textboxes

I have developed a code to create dynamic textboxes on click of "Add" button using javascript - Javascript function GetDynamicTextBox(value,index) { return '<input type="text" name="...
3
votes
1answer
3k views

How can I save multiple values selected in a list?

I have a form with the dynamically generated XML and by dynamically, it was programmatically created during getForm function. I want to save the value I selected as a key:value pair to be stored in a ...
3
votes
1answer
758 views

Validate Checkboxes within a Hidden DIV Only If Shown - Chronoform

I have a form in Chronoform where there are two checkboxes, when you select the second checkbox, a hidden DIV becomes visible. Inside this hidden DIV there are 16 more checkboxes. At least one of ...
3
votes
1answer
594 views

Send array from javascript to php by POST in Joomla 3.x

im trying to send an array from javascript to Joomla 3.x php file. var options = ['foo', 'bar']; $.post('index.php?option=component&view=componentview&Itemid=123&tmpl=component&...
3
votes
1answer
660 views

how to Validate captcha before submit a form in joomla

I have installed 5 captcha plugins in my joomla site and i set any one captcha out of 5 in com_users configuration in backend of joomla. So how can I want to validate that captcha from client browser ...
2
votes
1answer
925 views

Add script just after <head>

I'm registering to Google AdSense. In order to check the site they want that I put a piece of code inside (<script>something</script>) just after <head> tag. How can I do it?
2
votes
3answers
1k views

Joomla $document->addScriptDeclaration with single quote and double quote

Iam struggeling with the situation that I have to use single quotes and double quotes in Joomla $document->addScriptDeclaration. $document->addScriptDeclaration(' jQuery(document).ready(...
2
votes
3answers
2k views

Plugin development - parse error: syntax error, unexpected 's' (T_STRING)

I'm having a shot at developing my first plugin for Joomla, its just a simple plugin which places some javascript just before the close of the body. The javascript works fine if I place it directly in ...
2
votes
1answer
893 views

How can two libraries avoid loading the same Javascript library twice?

Let's say my extension makes use of a popular JQuery plugin. I can include the Javascript file in my extension and link to it using JHtml::script or another method. The trouble is that for all I know,...
2
votes
2answers
41 views

How to include scripts in <head>

Ok I am having a hard time with this one. I just inherited a 3.8.x Joomla site and all I'm trying to do is include a GTM script in the head of the document. What's happening is that anything within ...
2
votes
4answers
1k views

How can I insert js scripts before </body>

I know this question is been asked again, but i tried their solution and it doesn't work so please don't rate it down. I have an authentication script (auth.js) that needs to be placed before the tag,...
2
votes
1answer
692 views

Refreshing a part of the page after Dropdown list selection

How can I refresh a part of the page when I select from a dropdown list using the onchange in HTML? I have a Reports dropdown list. Once I select a Report, a list refreshes only displaying those that ...
2
votes
3answers
1k views

Advice on creating a custom searchable db within Joomla

I have been asked by a friend if I can make their existing Library db more modern and user friendly, whilst incorporating it into their existing website. The existing db is a simple access db ...
2
votes
2answers
28 views

My Joomla Template is loading my custom CSS using JS. Is there a way to add the unique version tag to my custom CSS? i.e: custom.css?20180101

I normally just add my unique tag to the css path in the section of my html, but my template is adding my custom CSS via Javascript: if (is_file(T3_TEMPLATE_PATH . '/css/custom.css')) { $this->...
2
votes
1answer
763 views

How to call jQuery in joomla on specific script

I' m trying to use jQuery contextMenu within a joomla 3 site. The basic jquery code for the menu is: $(function() { $.contextMenu({ selector: '.context-menu-one', callback: ...
2
votes
2answers
866 views

Change Element Background During Scroll

Trying to get this script to work on this site: var t = $('#preschool-program').offset().top - 120; jQuery(document).scroll(function(){ if($(this).scrollTop() > t) { $('...
2
votes
1answer
274 views

CSS/JS compression distorts the website template/look

My website has a score of 50/100 on pagespeed. I am trying to improve it's load speed. When i implement compression either via template (T3 template option)or JCH plugin the website completely looses ...
2
votes
1answer
962 views

Stop Joomla! 3.4.1 from including scripts in custom component pages [duplicate]

I'm trying to prevent Joomla! 3.4.1 from loading certain default scripts in the front-end template when a custom component is displayed. I am excluding the scripts in the template index.php file as ...
2
votes
1answer
131 views

Designing selectbox in joomla

I have a selectbox in which options are coming from a module. Following is its code. <div id="dropdown"> <form action="" method="post" name="country"><label for="country"></label&...
2
votes
1answer
580 views

RokSprocket automate Load More

for people that have used Joomla for a while you are probably familiar with RokSprocket - a content module from RocketTheme, very useful. It has a 'Load More' button, that can load the next bit of ...
2
votes
2answers
642 views

2.5 template/css issues: article links not working in Chrome, link colors locked globally to white and email cloaking

I'm a Joomla, CSS and php newbie. I was tasked with creating a site for the school I just started working for based on its already hacked-up Joomla 2.5 template. I hacked it some more to get the ...
2
votes
1answer
120 views

Javascript Menu conflicts

I'm converting a static website to a Joomla 3.3 template. which has 1 level dropdown box javascript menu this is the function included in my "index.html" $(function () { /** ...
2
votes
1answer
143 views

Lazy loading script doesn't run after AJAX load

Issue related to Video lazy loading skipping first video in every list The css shows up with a black box and the arrow, but script doesn't seem to run after ajax load from pagination, and also when ...
2
votes
2answers
654 views

How to remove the type attribute from script tags of an Html5 document?

From the beginning of december 17, W3C XHTML started to point out this error: The type attribute is unnecessary for JavaScript resources. The above warning is generated inside Joomla script itself ...
2
votes
1answer
601 views

custom table display - help turning static html to dynamic php

I am trying to modify the list view of my Joomla component to display my table's data in a more user-friendly fashion. It currently simply displays all data in a regular table with columns and rows, ...
2
votes
1answer
440 views

Template Modal Conflict

Joomla 3.6.5 Joomshaper Helix 3 Template link FavimageHover Module link I have the FavimageHover module installed on my site, it works great until I try and add images via the front-end. There seems ...
2
votes
1answer
937 views

Run MySQL Query From Button Click

How can I run a MySQL query from the onclick event of an HTML button on my site? For example if my button is created like so, how could I use this to run a MySQL query titled AddInfo <p><...