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.

616 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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
15 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 ...
1
vote
0answers
16 views

cms pages and block is not loading in backend

CMS pages and blocks won't load in the backend. It keeps loading and loading without not showing any pages or blocks. I reindex, compile, clear cache... But nothing changed. Any help would be much ...
1
vote
0answers
22 views

Add multiple products to cart using product ids

I am trying to add multiple products to my cart. I have product ids in the form of $productIds = implode(',', array_column($points, 'productId')); which gives me numeric product ids like this : 5330,...
1
vote
2answers
138 views

MagenImage Upload File Extention JS Validation?

I'm new to Magento 2.3, i want to validate file upload field. Allowed file formats: jpeg. I put a method in lib\web\mage\validation.js require([ 'jquery', 'jquery/ui', '...
1
vote
0answers
37 views

magento 1 checkout page gives error “checkout is not defined” in console prototype.js::5598

i am using firecheckout for magento 1 checkout page gives error "checkout is not defined" in console prototype.js::5598. because of that error sometimes customers can not place order. can anyone help ...
1
vote
1answer
28 views

Some unwanted random values appending in script tag

I have removed some malware from a website but my googleads is not approved. I asked them they said there is an issue with javascript tag. I want to know is that correct or not. Our default script ...
1
vote
0answers
32 views

Uncaught ReferenceError: Mini is not defined at (index):993 - magento 2 store

How do i trace and fix this error for my magento 2 store? Uncaught ReferenceError: Mini is not defined at (index):993 i can not find the below code anywhere in my magento admin. it is not in header, ...
1
vote
0answers
49 views

Magento 2 Issue with JavaScript and CSS Merge

I have checked my site for speed and it was requesting 258 requests. I have merged all JavaScript and CSS files and again tested it but still 251 requests are there. While in view page source I can'...
1
vote
0answers
37 views

AJAX call returns the same page html

I have a module that I need to do a php GET action and get some informations from php file. The problem is that the returned value is the Dashboard html. Faturamento/Controller/Adminhtml/Ac/Index....
1
vote
1answer
25 views

Magento theme displays errors and responsive display after refresh

We have a Magento webshop (1.9.3.2) with Ultimo theme, which appears to have some strange problem in a few browsers - we've discovered it's only on Chrome and Opera so far. When you first watch the ...
1
vote
1answer
57 views

Masonry in magento 2

does any body have idea that how to include masonry in magento 2? as i added requirejs-config.js them in masonry i used require on the top of the code then i added this code in bottom of list.phtml ...
1
vote
0answers
44 views

How to select a shipping method if the default address is present in checkout page in Magento 2?

I need to select the first method rendering in the list as the default selected among the shipping methods in the checkout page for a customer whose default shipping address is pre-populated in the ...
1
vote
1answer
118 views

I just implemented Bootstrap 4 in my magento 2.2.5 website. Require.js 166 Error

In my environment implemented Bootstrap 4 in Magento 2.2.5 at first glance it seemed to work. all of my js and css worked perfectly without any error's. But after sometime, I got error: Uncaught Error:...
1
vote
1answer
181 views

How to use owl carousel using require js in magento 2

Anyone can help me out how to use owl carousel using a custom theme by using require js I have downloaded owl carousel zip file from an official website. I want to use this owl carousel in my block ...
1
vote
1answer
141 views

Uncaught Error: Mismatched anonymous define() magento 2.2.4

Below is the console erros is getting in frontend. Checked .htaccess in pub, pub/static and root all .htaccess are identical to Magento 2.2.4 version. js bundling/minification is enabled and ran ...
1
vote
0answers
74 views

Show magento loader ajax

how can I show the loader only on my div and not on the body during an ajax call ? Can't make it work. Here's my code, I have the show loader and the context but I'm missing something ? <div id="...
1
vote
0answers
19 views

Magento2 : Fire body loader with text/x-magento-init

i have a custom block on my page, that calls javascript via text/x-magento-init and performs some operations so loader should be displayed untill that script will finish its operations. How can i fire ...
1
vote
1answer
27 views

Adding JS code Always showing below footer

I am inserting JotForm JS code in specific CMS Page but it always showing after footer. Even when I add jQuery CDN, it always showing after footer. I have tried head.phtml, header.phtml, CMS page ...
1
vote
1answer
130 views

Magento 2 - problem with mCustomscrollbar.js

Since few days i try to fix issue with my mCustomScrollbar plugin and i got stuck. First of all i i've got library with mCustomScrollbar.js and mousewheel.js in web/js/mCustomScrollbar and my ...
1
vote
0answers
26 views

how to download wishlist in excel format in magento 1.9

i want to download my wishlist in excel format without any plugin, currently i'm able to download my wishlist as docx type. Please help.
1
vote
0answers
16 views

Closure Compiler support

It seems there are several performance extensions for Magento 2 but none of them mention Closure Compiler which still yields the best results compared to the current minifier. The extensions which I ...
1
vote
0answers
28 views

Magento 2 remove lazy load header cart with items

We are currently developing a new Magento 2.3 store, but we find out that items in the cart in the header, are loaded quite late. When we load a page on frontend, first the entire page loads and then ...
1
vote
1answer
84 views

How can i disable till 1 week next future dates in Magento js Calendar?

I want to allow customer to choose dates after 1 week from current date. Like as today date is 15 Feb 2019 so customer can select dates from 22 feb 2019. I did change js for calendar by adding below ...
1
vote
0answers
73 views

CSS and JS merging options is not working on Magento 1.9.2.4

I am simply trying to enable the option of merging JS and CSS on configuration > system > developer and I have cleared the cache and even tried to delete the VAR folder and still having CSS and JS not ...
1
vote
0answers
79 views

JSON.parse: unexpected keyword at line 1 column 1 of the JSON data

I am getting this error in checkout. Below the Shipping Address form, Shipping Methods is stucked on loading. In console it says: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data ...
1
vote
1answer
17 views

How do I utilise Javascript merging?

To be clear, this is not a post about Javascript Bundling. This is about Javascript Merging. So, I'm in Production Mode and I'm starting to look at the optimisation of Javascript Merging. My ...
1
vote
0answers
20 views

Class not defined in validation.js after upgrade to 1.9.4.0?

I updated from 1.9.3.7 to 1.9.4.0 using the .mage command line tool. Everything works fine in the admin, the frontend however always shows me Class is not defined. The code where this happens is in ...
1
vote
0answers
31 views

Mega menu issue with product zoom

I am using Magento 2.2.6 on the product page, When you view a product, and then you go to Products Menu, once the mega menu is shown up, move mouse to the menu item over the product picture area, then ...
1
vote
0answers
41 views

How to use javascript in ko template in magento 2?

I have a custom module which will overrride vendor\magento\module-checkout\view\frontend\web\template\shipping-address\shipping-method-item.html, here is the code <!-- /** * Copyright © Magento, ...
1
vote
0answers
155 views

Magento2: custom javascript not called when using with text/x-magento-init

In list.phtml (product listing) I am showing requistition lsit for every product using type="text/x-magento-init" in loop as: <script type="text/x-magento-init"> { "*": { "...
1
vote
0answers
44 views

How to add a configurable external JS with additional data- attributes via requirejs?

I was trying to add an external JS, say https://foo.bar/script.js (the url is configurable via config data) via requirejs, and I was successful so far. But then I realized that I would need to provide ...
1
vote
2answers
713 views

how to trigger click event in M2

In my header section I have user name and if user have access to different location then he has button saying click me. I want to send ajax call on this button. But JS is not working. Can anybody help ...
1
vote
2answers
207 views

How to Load JS File at the Top?

I load my custom JavaScript file the following way: In: app/design/frontend/VENDOR/THEME/Magento_Theme/layout/default_head_blocks.xml I put: <?xml version="1.0"?> <page xmlns:xsi="http:/...
1
vote
0answers
58 views

Extend a default JS component or Use Mixin

Which is better and recommended to use Extend a default js component as explained at https://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html#extend_js or to use Mixins ...
1
vote
0answers
225 views

Magento 2 Knockout Js Customer Name update issue after changing customer name

I am having strange issue. In header, along with Welcome message i am showing Customer full name. For that i am using knockout.js concept. <?php if($block->customerLoggedIn()): ?> <li ...
1
vote
4answers
702 views

I want to translate “Buy” and “save” word in tier_price.phtml file. magento 2

I want to translate "Buy" and "Save" word in tier_price.phtml file.I have added the word in translation csv file but it is not working form me. Refer screenshot PATH : vendor/magento/module-...
1
vote
0answers
288 views

display a popup once per day!

this code is to display a pop up once per day. But I'm having trouble making it responsive, and it seems that it shows once a lifetime... Also if I put it in 3 different pages, and it only shows up ...
1
vote
1answer
649 views

Extend Swatch rendered js file

How to extend the Swatch rendered js file in my custom module? I have override the phtml template files. <script type="text/x-magento-init"> { "[data-role=swatch-option-<?= /* @...
1
vote
1answer
345 views

Magento 2 jsonParse() does not receive data, Unexpected token '

I'm creating a js template in Magento 2. When I call js, I get an Uncaught SyntaxError: Unexpected token 'in JSON at position 96. Why jsonParse () does not get the value? Can somebody help me? file ....
1
vote
1answer
86 views

How To Debug Custom Feedback Form Sidebar Slider JavaScript Error?

I'm trying to create a Feedback form Sidebar slider. Workout: step 1: C:\wamp\www\magento\app\design\frontend\default\theme327k\layout\local.xml <?xml version="1.0" encoding="UTF-8"?> <...
1
vote
0answers
447 views

Constr is not a constructor Magento 2

I simply want to add js for my custom module but I'm getting this error: layout.js:137 Uncaught TypeError: Constr is not a constructor The hello.js file will still work, console.log will still ...
1
vote
1answer
69 views

Magento 1.9 How to add js to order review tab?

I want to hide an the tax row, but I dont know when is generated so I can add some js to hide it.
1
vote
2answers
40 views

JavaScript and CSS don´t works in my Magento 2 page

I found a "partial" solution on the Internet, but if I use that "solution", my store don´t works: If I use that, this is the result: Home JS page Store Like you can see, if it makes me choose ...
1
vote
0answers
54 views

How to solve Js load error? Shipping Extension

I am using Sendle shipping extension, this extension work as, if you give zip code gives auto suggestion of city, after I migrate server, the auto suggestion not working. The extension developer ...
1
vote
0answers
47 views

Issues creating a widget with repeated functionality in Javascript

Have a controller class setup as a widget. Labeled here as "buttonController". I'm trying to call and instantiate an instance of the controller widget per each button. Everything seemingly works, ...
1
vote
0answers
120 views

Magento 2 – default admin editor -where is settings js code?

I want to change admin editor setting but not found config js code, please guys share me JS code path so i can change editor settings.
1
vote
1answer
389 views

Magento2 - Wait for checkout page completely loaded and fire JS code

The goal is to add a piece of JS to manipulate a datepicker on the checkout page. I use a OSC (OneStepCheckout from mageplaza). So far I've followed this documentation and added this mixin: var ...
1
vote
0answers
26 views

Magento 2 : How to Use Custom AJAX Code in Admin Front End

I'm developing a delivery system for handling parcels that are handled the delivery agents. since I'm a open cart developer and new to magento, its hard for me to develop. Kindly tell me how to add ...
1
vote
0answers
67 views

Building javascript “Order by for same day shipping” countdown timer

I've got an online store in Magento and I want to add a countdown timer so that if a customer orders by 5pm Eastern Standard time their product will ship the same day. I need it to be freely usable in ...