Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
1answer
68 views

Video lazy loading skipping first video in every list

I'm using code found here: https://codepad.co/snippet/CtLEQDKX to lazy load the preview image for youtube videos within JComments. I have it working pretty good and looking like I want it to and it ...
0
votes
1answer
691 views

RSForm Pro Search form

I have created a search form with RSForm Pro, unfortunately it isn't working. The concept is to do a TAG Search all the Fields of the Form (Select and Radio) have values which are part of a URL which ...
1
vote
2answers
24 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->...
6
votes
2answers
456 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: $...
1
vote
1answer
718 views

Add click event on bootstrap tab?

How to add an onClick event on Joomla bootstrap tabs. https://api.joomla.org/cms-3/classes/JHtmlBootstrap.html echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'monday')); echo ...
0
votes
1answer
102 views

Parsing Error Javascript in php include page on the test server

We're getting this error in our test environment: Parse error: syntax error, unexpected 'var' (T_VAR) in /home/usaspo5/public_html/dev/usgnew/components/com_usg_programs/tmpls/default.php We have ...
0
votes
1answer
71 views

Make calendar dynamically in 3.7

I recently found out that the datepicker and calendar changed a lot from 3.6 to 3.7 and as a result I'm having a problem with my custom backend component. Originally this is the code I was using to ...
0
votes
1answer
29 views

Send values from article to article

I have two articles in my Joomla site. One article has various links to the same article. The other article display, with code of java script, the HTML content of a file depending on what link was ...
0
votes
4answers
2k views

About jquery and $document->addScriptDeclaration($js) by developing a plugin

I seem to be having an issue when using jQuery in my plugin, which results in a blank page. When I delete the last line $document->addScriptDeclaration($js);, the site display but the code doesn't ...
3
votes
6answers
638 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
3answers
208 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
1answer
526 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&...
2
votes
4answers
842 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,...
1
vote
1answer
504 views

“0 Class 'JToolbarHelper' not found” error while trying to login to the backend

I am trying to login to the backend of my Joomla installation and have this error: 0 Class 'JToolbarHelper' not found I'm not sure how to fix it. I updated the tmp directory in the server setting ...
2
votes
2answers
31 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
1answer
836 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?
1
vote
2answers
85 views

How to build valid json object for a component's ajax response?

I've set up an Ajax call in my component. I seem to have got the initial call, the controller, the data model is working because when I make the JavaScript call I'm showing this in the code inspector ...
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 ...
0
votes
1answer
72 views

Navigation link to div id does not behave correctly

What I'm doing I am currently working on my Menu. I have one Menu-Item which links to a <div> that I have given an <div id="foo"> I link to this id by using the external url option with ...
1
vote
1answer
10 views

Targeting An Element On a Specific URL

I need to run an alternate header on a single top-level Joomla page. From what I can see, unlike Wordpress Joomla doesn't assign an ID to individual pages, making this a pain. I'm wondering if I can ...
0
votes
0answers
10 views

Joomla -> JEvents Calendar -> Override Submit Button of edit form

I am using Joomla 3.8 with JEvents v3.4.47. The page where you can edit the calendar entry contains a joomla submit button: <button onclick="Joomla.submitbutton('icalrepeat.save');" class="btn ...
0
votes
0answers
27 views

Question about adding custom javascript to template

I´m working in a Joomla! Template and am wondering: Why the javascript in the site doesn´t work if the file is inside a folder in the root folder of the template ? Why only works if the javascript ...
0
votes
1answer
316 views

Virtuemart conflicts in dropdown only sometimes

I am using Virtuemart and enalbled a "Multi-Variant" options. It nearly works, in the sense that only sometimes the product page (which has the custom options dropdowns) gives a JavaScript error. Some ...
-2
votes
2answers
354 views

How to access the email of the user who created a submission?

I have the following working javascript code: var user_email = document.getElementById("jform_user_email"); user_email.value = "<?php echo JFactory::getUser()->email; ?>"; The next lines ...
0
votes
2answers
41 views

Accessing Jdatabase via JavaScript Or Passing PHP varibles to JavaScript

I want to use this SVG Pie Chart on my Joomla site but the problem is I need to access data from Jdatabase and feed it to its index.js $(function(){ $("#pieChart").drawPieChart([ { title: "Cash"...
2
votes
1answer
34 views

Make div disapear after a while

I have made a page, where if the user update its form, the backend will send the user back to the form with a message like this: header('loaction:/index.php?msg'); On the index.php site, it loads ...
0
votes
1answer
138 views

CSS files and Js files not loading in https

Recently I try add https to a Joomla site. In https everything was ok, now it’s not loading some CSS files and Js files. Using the network tab in chrome dev tools I get the following error: (failed) ...
1
vote
1answer
44 views

Cannot get variable to update in IF/Else statement based on page class

I am trying to dynamically update a variable in a link depending on the page class, but I cannot seem to get the variable ebox to update in the if/else statement below. At present the variable is ...
0
votes
0answers
121 views

Cannot read property 'appendChild' of null when embedding JS game

Update 2: Ok, so I've realised that the 'css' was actually 'scss', after compiling it down everything is working as expected. Update: I have managed to get the cards to load, by moving the js file ...
1
vote
3answers
1k views

How do I use Javascript to find the baseurl, add some other parts of a url and open in a new page?

I'm using Joomla 3 and want to use Javascript to find the base url of the page, extend this url with some other bits and send a variable through the url. Then open this page in the same window. ...
1
vote
1answer
90 views

What is the correct way to add Javascript as of Joomla 3.x?

I'd like to know the 'currently' correct way to add JavaScript to the head of a page. The documentation suggests using $document->addStyleSheet($url);, but the API documentation says that this ...
0
votes
1answer
103 views

Trying to embed custom YouTube iFrame into Joomla module

I have some custom code which randomises a joomla video, this works fine outside of Joomla as can be seen at this fiddle, however when the code is placed into a Joomla custom module and published the ...
1
vote
1answer
41 views

Dynamically change ID of a href based on page class

I am looking to create an override of a component to add a button, however for each page that uses the override, I need the button to have a different ID as by clicking the button it will open a ...
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
537 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, ...
3
votes
1answer
389 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 ...
2
votes
2answers
581 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 ...
0
votes
0answers
143 views

Animated change logo size on scroll script creates a library conflict or some other loading issue

I'd like to have the logo shrink when the page scrolls down and expand to original when the page scrolls to the top. Except for the preloader with rotating icon, my code prevents the page from loading ...
2
votes
1answer
258 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 ...
0
votes
1answer
264 views

Please correct the path for Joomla Javascript Async and Defer plugin

Hello i want to Defer parsing of JavaScript of the following link in joomla by using Javascript Async and Defer plugin. http://www.domain.com/media/plg_jchoptimize/assets/gz/1/0/...
0
votes
0answers
99 views

addScript breaking frontend editing

I have a piece of code in a component that I am building that loads maps in a tab in the admin view. The code works perfectly on the admin side, but when I attempt to add frontend editing, it's ...
1
vote
1answer
242 views

How do I add “id” to script declaration

In the example below, the loaded script will appear in the 'head' with a plain 'script' tag but how do I add an id into the declaration so the result is something like 'script id="my-script"' $...
1
vote
2answers
1k views

Login to Joomla website from mobile App

Background I have Joomla website and mobile App that's running on different server (programmed using JavaScript). Both belong to the same party, and the users have similar accounts on both with ...
-2
votes
1answer
32 views

FutureProspect Theme How to deactivate the top toggling effect?

I am using the FutureProspect template on my Joomla website. The only issue what I am facing is the availability of the following effect, which is irritating on the mobile effect: Kindly let me ...
1
vote
1answer
138 views

render/execute jasvscript code (which is in a php string) inside virtuemart JDispatcher eg: plgVmConfirmedOrder

I want to render/execute some javascript code written inside virtuemart JDispatcher eg: plgVmConfirmedOrder eg: $script='console.log("this is dummy script");jQuery.ajax({url:'',type:'post',success:...
1
vote
2answers
45 views

Test site not rendering template list php error

Okay, so we have a section of our server portioned off to be a nested test site. However for whatever reason the below template causes an error in Joomla's php handler that it does not on the active ...
0
votes
1answer
68 views

How to insert tracking JS code (snippet) into Piwigo gallery?

Javascript code for tracking which was incorporated into Joomla installation through a Custom HTML module has no effect on Piwigo gallery. How visits to the gallery could be tracked, i.e. where the ...
2
votes
1answer
399 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
570 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, ...
1
vote
2answers
161 views

best way to add third party js and css

I need to add a third party js and CSS to my template head. I'm getting Leverage browser caching and someone advised me to load the files locally. created a directory in root: assets/third-party/ ...