Questions tagged [javascript]

JavaScript (JS) is a client side script language which allows to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. By default Magento 1 comes with the prototype.js library and Magento 2 comes with jQuery. Use 'prototype-js' and 'jquery' tags for questions about those libraries.

612 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
317 views

Magento 2.3.1 not loading correct javascript files (tinymce)

I've upgraded from Magento 2.2.6 with Theme Ves Fresh 2. I have tried to clean all caches delete static folder and restart Varnish, but had no luck so far. The errors include: GET https://shop....
2
votes
2answers
104 views

Magento 2 secret key problem

I've a form that performs an Ajax call to a controller, but the response always is You entered an invalid Secret Key. Please refresh the page. PereiraTech/Faturamento/Controller/Adminhtml/Ac/Index....
2
votes
0answers
134 views

JavaScript Bundling Not working in Magento2

I have refered https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/js-bundling.html for javascript bundling: After doing all the step i have check Network in browser and it seems found ...
2
votes
0answers
57 views

Magento 2.2.7 checkout JS Components will not be loaded

After I updated from Magento 2.1.5 to 2.2.7 my checkout is not working any longer.When i click checkout button it continuously loading
2
votes
1answer
1k views

TypeError: require is not a function

I add JS file in custom module Vendor\Module\view/adminhtml/layout/default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:...
2
votes
1answer
84 views

how to add onclick method in magento2 admin custom module page?

my edit.php file in magento admin custom module $this->addButton( 'approve', [ 'label' => __('Approve'), 'onclick' => 'deleteConfirm('...
2
votes
0answers
129 views

Google Chrome is failing in loading require.js files in time

On Magento 2 (ver 2.2.5), with Google Chrome (ver 72.0) I'm getting a wired error I wasn't getting withe previous Google Chrome version (ver 71). When I visit a product page, I get more then one ...
2
votes
0answers
42 views

How to edit source of the index page in Magento

I am a professional PHP developer, it's been like 2-3 days since I am trying to work with magento. My task is to optimize the index page. Thing is, I can not edit the "actual" source of index page. ...
2
votes
0answers
160 views

Magento 2.2 x or 2.3 - to bundle or not to bundle

I've read so many conflicting write up's and blogs about whether to "Enable Javascript Bundling" or not. Some say it's slow and some say it's faster when enabled. From what I understand it takes all ...
2
votes
0answers
349 views

Should i use tinymce or tinyMCE in magento 2.3 and also usage for backward compatible

From magento 2.3 i see core team integrated new version of tinymce. It's a good thing. Maybe future they will add more editor for magento. But i have a confuse a bit when to use wysiwyg through below ...
2
votes
0answers
104 views

Magento2 error after theme upload: Invalid template file

After uploading new theme files (Hebes) to Magento 2.3 installation I receive the following error: 1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file:...
2
votes
0answers
108 views

Mini Cart Update issue

I am facing mini cart update issue - to replicate the issue you need to browse the site and add a product to the cart - then continue shopping. If you press checkout (instead of continue shopping) the ...
2
votes
1answer
249 views

Upgrade to 2.2.6 missing static JS files

When I upgraded my Magento 2.2.2 to 2.2.6. I got one critical error in pub/static missing one file named trim-input.js "pub/static/version1540806968/frontend/{...}/{...}/pl_PL/mage/trim-input.js" ...
2
votes
1answer
298 views

Magento 2 TypeError Undefined products images not displaying / js not loading

At home page, product category view and product detailed view page images are not loading / displaying at firefox and less frequently at chrome. I am using magento 2.2.6 upgraded from 2.2.2 and porto ...
2
votes
0answers
84 views

Node modules in theme

I am new to magento and i have researched this issue i am having for enough time to post it here. My goal is to understand how require-js works with node modules. Case: $themeDir = app/design/...
2
votes
0answers
43 views

Negation in the imports link (UI component)

I've got the fieldset component in my custom UI-form: <fieldset name="default"> <settings> <label>Default</label> <collapsible>true</collapsible&...
2
votes
0answers
530 views

Mixin js file in Magento 2

I am attempting to override this file \vendor\magento\module-checkout\view\frontend\web\js\view\form\element\email.js First I create a requirejs-config.js file in C:\wamp64\www\magento222\...
2
votes
1answer
436 views

Magento 2 Missing JS function

Magento 2 Centos 7 Mariadb 10 When I try to add a product from the admin panel I get the spinning wheel of death. import-handler.js:44 Uncaught TypeError: component.getPreview is not a function ...
2
votes
0answers
154 views

minicart ko in magento2

Js file qtyOptions: ko.observableArray([]), initialize: function () { this._super(); for (var i = 1; i <= 4; i++) { this.qtyOptions.push(i); } return this; template file &...
2
votes
0answers
125 views

On mobile submenu 'All %categoryname' is not translated - Magento 2

I can't translate the string 'All' from the subcategory on mobile menu. The file where the string appears is menu.js located on public/lib/web/mage/ And it looks like this: .text($.mage.__('All ') + ...
2
votes
0answers
210 views

Javascript file 404s when loaded via Require JS alias

I've ran into a strange problem where a custom javascript file 404s when loaded via a RequireJS alias but it works fine when loaded directly. This does not work Require JS var config = { map: { ...
2
votes
0answers
559 views

Async loading of javascript in Magento for PageSpeed

I'm trying to optimize my Magento 1.9.3 website, following Google PageSpeed hints, saying I have js and css that load synchrounously and block the page rendering. To solve this issue, I'm putting ...
2
votes
0answers
141 views

JS mixin on a js file with a single return in Magento 2

I'm having trouble with mixin in Magento 2. I would like to override the following file to edit a function. Magento_Checkout/web/js/model/new-customer-address.js: define([ 'underscore' ],...
2
votes
0answers
116 views

Javascript load order

I need to load some JS libraries the last of all. I used to achieve this using data-group param, like this: <?xml version="1.0"?> <layout version="0.1.0"> <default> <...
2
votes
1answer
50 views

Add Javascript globally in Magento 2 backend

I have a custom extension that has a javascript file which need to run on every page in magento 2 backend to use jquery and ajax function, is there a way to do this action with custom extension?
2
votes
1answer
769 views

magento 2 spConfig access

how can i access the spConfig variable in a custom function on product view page. <script type="text/x-magento-init"> { "#product_addtocart_form": { "...
2
votes
0answers
417 views

Magento 2 : How do I hide a Customized Checkout Step

I have added a custom step in checkout. I would like to use some JS to hide or disable the step based on if the associated shipping option is selected or not. I tried to wrap it in if statement but ...
2
votes
0answers
412 views

Checkout Page - JavaScript can't target inputs

On my checkout page I'd like to do some JavaScript on Inputs and other elements. It seems like I can't access certain part of my page. To verify i tried $("form").html("these forms I could find"); ...
2
votes
1answer
111 views

Store view with messed up CSS

I have set up a German view in addition to the current default view and the css is messed up when I change the language. It looks like it goes into mobile mode. The website is http://m.theseolounge.co....
2
votes
0answers
244 views

Magento hangs when I click Save and Continue Edit

Windows 10, Magento 2.1, XAMPP, Stores > attributes > product > add new attribute > properties fill in [Default Label] and click — Save and Continue Edit. It says please wait... and the software ...
2
votes
0answers
451 views

Add full version of jquery mobile to magento2

Magento2 loads by default a custom build of jquery mobile library: deps: [ "jquery/jquery.mobile.custom", If I try to add the full version of the mobile library (require it in my theme): var ...
2
votes
2answers
1k views

Auto Select colour Swatch when configurable product page loads

I have a configurable product with one colour and different sizes, both these are set as required fields. I've set the colour attribute as not required, but then it wont show up when I create a ...
2
votes
0answers
1k views

Where to add Mailchimp Subscriber Popup code in magento

I apologize if this question has been posted before, but I checked all over google and could not find anything. I am trying to add the Mailchimp subscriber popup to my homepage, but cannot figure out ...
2
votes
1answer
574 views

Update price without refresh the page

I am working on magento2 customization calculation functionality. In this i have width and gather two field is there in text field I have to calculation with product price eg. pricewidthgather like ...
2
votes
0answers
773 views

Magento SOAP API: How to get SOAP response using JavaScript

I'm able to get SOAP response using Magento SOAP API by using PHP code. Now I want it using JavaScript/AJAX request. How can I accomplish this? What steps should I follow prepare my Magento to allow ...
2
votes
1answer
1k views

Drag and drop category error

I get There was a category move error. on moving(drag and drop) subcategory to another root category. How I debug this? on console I get Expected to start loader but did not find one in the dom this ...
2
votes
0answers
565 views

Adding custom xml to CMS page's Layout Update XML fails to load the script

I am trying to add Java script to a specific CMS page to be loaded in the <head> area. The scripts fails to load. name.min-1.0.js and name.Mode.js are placed in {magentoroot}/js. The ...
2
votes
0answers
3k views

Swatch customization issues

well we have heavily customized Magento 2 website. The swatch customizing is done in: app\code\My_Package\CustomSwatches\view\frontend\web\js\SwatchRenderer.js by overriding: vendor\magento\module-...
2
votes
0answers
665 views

Web service API SOAP v1 using java for connect?

In official site exists this faq http://www.magentocommerce.com/api/soap/introduction.html And in line As of v1.3, you may also use the following URL to access the Magento API v2, which has been added ...
2
votes
1answer
171 views

Magento 2 How to add external Js in a page

I want to add an external js in my home page. The external js loads a popup form in my home page. I have tried the code in phtml file and also in xml file. In both case the form will appear. But some ...
2
votes
1answer
1k views

Knockout JS removes jQuery change event

I don't know if it is specific to Magento 2 but an already set up HTML node with jQuery change event attached to it will lose its change event when run inside a knockout component with attached VM (...
2
votes
1answer
2k views

Magento2 Get Customer Custom session Data in Javascript file

I am trying to get the custom session data of Customer in a javascript file. As I am passing 'Magento_Customer/js/customer-data' as dependency in order to retrieve the data. define( [ ...... '...
2
votes
1answer
1k views

Magento 2 : How to Implement Swiper Plugin

I'm trying to convert html template to Magento 2.1.3. I started my conversion using blank-sass from Snowdog. Some CSS was sucessfully implemented but I can't figure out many points. One of them is how ...
2
votes
1answer
63 views

Magento 2.0.2 js not loaded

Magento 2.0.2 giving error -Failed to load resource: the server responded with a status of 404 (Not Found)
1
vote
1answer
33 views

Script executar apenas para algum manufacture

I want to make javascript at the end of the file run only if the product is not from the "hello-kitty" manufacturer but for that I need to somehow take the manufacturer of the product to store in a ...
1
vote
0answers
46 views

React Router Breadcrumbs use page titles instead of url dynamically

I've got a magento 2.3.1 site with venia storefront a react front end and I'm trying to get the breadcrumbs to pull the page titles dynamically rather than pulling the url. My current code for the ...
1
vote
2answers
113 views

Magento 2: jQuery Datatables Button Extentions Not Working

============================UPDATED 1.1============================ I'm new to Magento 2.3, I'm trying to apply jQuery DataTable(DONE), after than, I want to add it's Button Extension, for that i ...
1
vote
0answers
56 views

Magento2.3 : How do I programmatically submit a form generated via a UIComponent?

I created a UI Component form, but I am unable to find the element in the source. I would like to click a button and then inspect a field in the form and dependent on what value is selected submit ...
1
vote
0answers
22 views

Failed to load JS and other support files while trying to checkout

I am trying to add a product in cart and check out the product, page still loading and it shown error message. enter image description here
1
vote
0answers
14 views

Backend listing grid view page not opening order listing cms page & block listing etc

Backend listing grid view page not opening order listing cms page & block listing etc.. Admin panel not able to load multiselect.html, text.html, html.html, actions.html and js file as per console ...