Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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.

Filter by
Sorted by
Tagged with
2
votes
4answers
75 views

How to use cookies to populate RSForm fields without notices/warnings?

I have used this code to save the RSForm data in a cookie and if the user tries to fill in the same form again, the previously entered data is loaded as default values: Script called on form display: ...
1
vote
2answers
45 views

How to overwrite a module's .php to control what scripts it adds to the head of the doc?

I am new to Joomla. I have installed a plugin and I want to overwrite the module file to remove some of the unwanted scripts. project modules mod_modulename mod_modulename.php How can I overwrite ...
0
votes
1answer
226 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 ...
1
vote
0answers
13 views

Cannot insert image in k2 article

I'm facing an issue on the backend side of my Joomla 3.9. I'm using K2 as the content builder and set TinyMCE as default editor. I wanted to insert an image by using the modal button "image", but, as ...
1
vote
3answers
155 views

Insert custom text to JCE using Javascript

How to insert custom text to JCE v. 2.3.4.4 using javascript? I have opened the page source and saw that the editor is an iframe. Text is in <body id="tinymce">. I was trying something like: $...
1
vote
1answer
886 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
204 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 ...
2
votes
1answer
30 views

TypeError: Form is Null on Button in Admin toolbar

I am receiving TypeError: form is null in the browser console when I select a custom button added to a form using JToolbarHelper. I can insert the button to any other component as is and it will ...
0
votes
1answer
38 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 ...
2
votes
2answers
30 views

Link to Page & Pre-Filter Portfolio Items

Joomla 3.9.10 I am using this template. I would like to create a link on my home page that when clicked, will take the user to the portfolio page and display a pre-selected tab.. For example my link ...
2
votes
1answer
25 views

SEF URL Broken Image Links When Fetching API Results

Using Joomla 3.9.8 I'm using the fetch() api in order to retrieve some data from a remote API. When I have the api results I'm displaying them in html elements. The API returns various values, one ...
2
votes
1answer
48 views

If I want to globally include a framework aside from jQuery?

I know I can use many of the items found in this documentation such as jQuery https://docs.joomla.org/J3.x:Javascript_Frameworks by doing something simple like this JHtml::_('jquery.framework', ...
1
vote
2answers
37 views

Joomla 3.9.X: Website speed on page speed

I have a site with joomla with a good template and excellent performance. The only problem remains the same: the speed for mobile on google pagespeed. On my site with joomla 3.9.x I have activated all ...
0
votes
0answers
57 views

Presentation API PresentationRequest is not defined

I've been trying to integrate this API: https://googlechrome.github.io/samples/presentation-api/ with my project. However, it always generates this error in the browser console: Uncaught ...
0
votes
0answers
20 views

Javascript in administration (modules / content-plugins) [duplicate]

i have one doubt / question and don't know how to solve it: Imagine you have a subform-field with the multiple-parameter active to add multiple content-blocks, now, the thing is, in real life there ...
2
votes
1answer
51 views

How to use HTMLHelper to add to the document head

In this post: How to add CSS/JS/an Image to a module backend @lodder shows me how to use HTMLHelper to add CSS and JavaScript. Previously I had followed the Joomla! documentation https://docs.joomla....
3
votes
1answer
655 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 ...
1
vote
1answer
23 views

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

I'm trying to pass a php array to javascript, but the array has non-sequential keys. Here is a portion of the array: Array ( [1812] => Array ( [RecID] => 1 [...
1
vote
2answers
1k 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 ...
1
vote
2answers
89 views

jQuery global array showing as undefined

I have set a couple of global variables on page load as follows: jQuery(document).ready(function() { console.log("Onload PHP vis_options:"+JSON.stringify(<?php echo json_encode($...
0
votes
0answers
84 views

Adding li to ul causes all li to end up outside the ul

I have a page that has the following uls on it: <div id="team1" class="team_name">Desperate Housewives <ul class="sortable ui-sortable" id="sortable_1" ...
1
vote
0answers
34 views

Echo PHP output in a slider effect

I'm fetching data using for loop and echo results on a page. How do I output the results in a slider effect? I have tried a simple CSS slider but can't get the intended result. What I end up getting ...
7
votes
1answer
3k 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 ...
1
vote
1answer
57 views

iFrame with javascript

I would like to summarize my problem: I need to obscure the source of the iframe from the source code. To do this I have to use javascript code and obfuscator. By inserting the following obfuscated ...
1
vote
2answers
198 views

Client side validation - custom event handler not called when user enters the field and leaves it being empty

I'm working on a JForm with some fields with custom event handlers to do client side form validation as it is described in this document The document says that "Joomla adds a blur handler to validate ...
2
votes
1answer
266 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 ...
0
votes
1answer
162 views

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

I'm working on a custom Joomla module. I have a JForm that contains multiple custom dropdown lists based on JFormFieldList. The form should be submitted when a value is selected from one of the custom ...
0
votes
1answer
112 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
745 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 ...
2
votes
2answers
38 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
878 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: $...
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 ...
2
votes
6answers
802 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
361 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
704 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
2k 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
2answers
414 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
1k 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
242 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
3k 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
123 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
14 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
1answer
384 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
357 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
58 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
237 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
49 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 ...
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
238 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 ...