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.

Filter by
Sorted by
Tagged with
9
votes
7answers
14k views

Magento 2: How to use Cookie?

How can we use cookie in magento 2 to store data.. i'm trying to store data in cookie, on vendor/magento/module-checkout/view/frontend/web/js/model/resource-url-manager.js to store selected ...
0
votes
1answer
16 views

Script injection below body tag in Magento 2.4.1

I upgraded our Magento from 1.9 to 2.4.1 after we found malware that was trying copy customer credit cards before allowing the customer to use PayPal. I used Magento's migration tools to copy data to ...
0
votes
0answers
4 views

jQuery (server side) search and sort using Ajax

I tried to create an search and sort from live URL using ajax I tried to create an search live using Ajax I am showing Ajax response in select options as below code. I want to sort the select options ...
0
votes
0answers
5 views

SET THE RIGHT DOMAIN NAME IN MAGENTO 2 COOKIES

I set cookies (in Magento 2.3.1 EE) with this code below: <script type="text/javascript"> require([ 'jquery', 'jquery/jquery.cookie' ], function ($) { $(document).ready(...
0
votes
1answer
1k views

mage/translation not working magento 2 (translation issue)

I am working on pdp page (mobile view), in drop down i need to show out of stock if qty is out of stock and low stock if qty is low stock, it is working as expected but it is not getting translated to ...
0
votes
1answer
13 views

Change position of elements/uiComponents in Magento 2 checkout depending on screen size

I have 2 html elements on my checkout for which I need to change the position on the page, depending on whether it's being displayed on mobile device or desktop. I cannot solve this using css only ...
1
vote
1answer
343 views

Magento 2: Autoplay product video when video icon on left panel is clicked?

I want to autoplay video when video icon on the left panel is click. Once the video icon is click the video on the container will automatically play. Here is the current classes on the video icon: ...
1
vote
1answer
18 views

Magento2 blank Checkout Page with JS errors

Since a few months the Checkout Page show blank except of the logo. In the Browser console there are several JS errors. There are a few threads about this error but nothing helped. I did try fixing it ...
0
votes
2answers
102 views

After upgrade to Magento 2.3 - js error in arrays.js in cart and checkout

I am updating an e-commerce with Magento, from version 2.1.18 to version 2.3.4 (I have verified that it also happens by updating to version 2.2.11). Everything went well, but when I add a product to ...
0
votes
1answer
21 views

How to add external JS script to product page in Magento 1.9?

I'm trying to add a JS Script for some specific products in the product detail page but I dont know how to. I know I can edit the xml file and add scripts there... but the source of the script ...
0
votes
1answer
24 views

Global Payments Realex 511 Redirect Issue Magento 2.2.2 HPP

I am using this module for Global Payments / Realex Payments for Magento 2.2.2 store form Magento Marketplace "name" : "realexpayments/hpp", "description" : "A ...
2
votes
2answers
75 views

Uncaught TypeError: Cannot read property 'remove' of undefined — upgrade from 2.3.4 to 2.4.1

Uncaught TypeError: Cannot read property 'remove' of undefined -- upgrade from 2.3.4 to 2.4.1 I'm testing out an upgrade of our Magento store from 2.3.4 to 2.4.1. One issue I have come across is this ...
0
votes
0answers
25 views

Magento 2.4 - Express Checkout - Shipping Address Error

A fresh install Magento 2.4.x + theme, but having some issue related to express checkout, as seen from below picture on red-box area. The form has missing some elements, like firstname, lastname etc. ...
0
votes
1answer
16 views

Magento 2.4 admin keep on infinite loading

I updated my magento from 2.1 to 2.4 . My admin panel keeps on loading since long. Below is error i see in console. Failed to load resource: the server responded with a status of 404 (Not Found) ...
0
votes
1answer
3k views

Magento 2.3 - Uncaught TypeError: Cannot read property 'version' of undefined [closed]

Installed Magento 2.3.1 with sample data there are no js errors on the console. After changing the theme to Ves Need from Venustheme. http://www.venustheme.com/theme/ves-need/ On hard refresh, the ...
0
votes
2answers
1k views

Magento 2 include google maps js only on contact page

I have a custom theme based on Luma, I'm trying to include google maps script only on contact page but it's not working. Here is my contact_index_index.xml file under my-theme/Magento_Contact/layout/...
0
votes
0answers
9 views

How to add a script to all product descriptions

How to create a js widget that will add the current date on the product page to the description on the <p id="lol"></p> element? Or which will insert a p tag with a date at the ...
0
votes
3answers
30 views

Magento 2 How to combine custom module JS in one JS file?

I have multiple modules installed on my website, all modules have scripts in phtml file. I need to move that all scripts into one JS file so it can reduce the page size and merged them as a JS file. I ...
4
votes
1answer
2k views

how to extend default javascript

I try to extend standard magento javascript configuration but I just get nothing. I'm following this: http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html and this: ...
0
votes
0answers
13 views

How to pass parameter from phtml template file to controller in Magento 2

I have created a custom module. It basically displays a popup modal that prompts user to enter their ship-to location. Below is my code: Learning\etc\module.xml <?xml version="1.0"?> &...
0
votes
0answers
8 views

how can I apply and clear a layered navigation filter via javascript in Magento 2.4?

I would like to create some quick filter buttons for layered navigation, for example to trigger popular filters like featured products, recommended etc. I would like to programmatically trigger the ...
0
votes
2answers
125 views

Magento 2.4: How can we remove datepicker.js in Magento 2.4

How do I remove datepicker.js?? I have tried in layout "default_head_blocks.xml" ```<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See ...
1
vote
0answers
26 views

How to hide aria-required = “true” field by js in checkout magento 2

I add these fields using custom modules, so that when "Persoana Fizica" is clicked, these fields are hidden and will not affect the magento's data transmission. And when I click on "...
2
votes
1answer
22 views

HTML files not being overwritten in app/Design

I'm trying to override html files the same way that I would override a phtml file, but it doesn't seem to be working. Same with Javascript. I'm trying to change some logic in minicart.js. I put my ...
12
votes
5answers
9k views

Magento 2 Store switcher error in “section-config.js” Uncaught TypeError: Cannot read property '*' of undefined(…)

I'm implementing a custom store switcher in my custom theme. Block template is as follow: <?php if (count($block->getStores())>1): ?> <?php $id = $block->getIdModifier() ? '-' ....
0
votes
1answer
1k views

Can Not View Content Blocks due to require.js error - Magento 2 theme change

I am facing problem with require.js on Magento 2 theme change Content > Blocks The page shows endless spinner and I can never view my imported blocks for my new theme. When I do Firebug on the page. ...
1
vote
1answer
1k views

Magento 2 How to add onKeyUp to a text field in customer checkout address form?

I want to add a auto complete function to the customer checkout address form, but I found that the address fields are rendered by knockout js, I can't add the "onKeyUp" attribute directly. How can I ...
3
votes
1answer
778 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 ...
3
votes
1answer
1k views

Magento 2 Init script after page load

Is there any option to init (text/x-magento-init) script after page load? Example, I am working on a simple quickview feature and my controller returns my a layout - phtml file - with rendered html ...
5
votes
1answer
1k views

All product images missing from admin but show in DB and front end

Using Magento v1.9.2.2 with patches SUPEE-7405 v1, SUPEE-7405 v1.1, SUPEE-8788, SUPEE-9652. Browsers: Safari & Chrome on Mac OSX. I'm having an issue where none of the images in the product admin ...
3
votes
1answer
2k views

Magento 2 - Stuck Checkout loader and Javascript error

I recently upgraded from Magento 2.0.7 to Magento 2.1.2 After the upgrade, I keep running into this issue with a stuck checkout loader and the following javascript error message when I begin the ...
3
votes
1answer
2k views

Using jquery in phtml got an error: Uncaught ReferenceError: require is not defined

I use jquery in my phtml frontend page like this: <script> require(['jquery', 'jquery/ui'], function($){ var currentUrl = '<?= $itemEditUrl ?>'; $('#link-cusom-campaign')....
0
votes
0answers
21 views

How do i translate Javascript text?

I've been trying to translate the word "Open Now" that is written in my JavaScript like so $('.store__info_' + locationCode).text('Open Now'); I followed the dev docs here, to no avail. I'...
1
vote
1answer
49 views

Magento2 - including THREE.js in custom module

I'm using a 3D model object in my Magento (2.4.0) site for which I need to use three.js lib along with GLTFLoader and OrbitControls. GLTFLoader and OrbitControls are THREE.js dependents. I kept the ...
1
vote
1answer
922 views

Magento 2: Frontend file uploader (jquery)

I need my users to be able to upload some files from the backend, with the functionality of a preview image, abort button, multiple files uploadable, etc. And since Magento already uses the blueimp/...
0
votes
1answer
38 views

Magento2: Sometime js load sometime js not load properly

I got the JS error in console. Sometime when page load got the JS error and Sometime when page load it is working. I don't know what's the exact issue. I disabled all 3rd party extension after that ...
1
vote
1answer
5k views

Blocked a frame with origin from accessing a cross-origin frame

when I want to go onclick to next page's specific div it shows this error . jquery.js:3123 Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a ...
8
votes
3answers
2k views

SSL Installed Checkout and Account Area Still Using HTTP and not HTTPS

I am running magento 2 ver 2.0.7 I have an HTTPS issue. I'm not quite sure why this is happening but in Stores -> Config -> Web. I have my secure base url set to https://mystore.com/ but when I ...
0
votes
0answers
28 views

How to check all elements of first array with single element of second array one by one using jquery

Like I have two arrays and I wan't to disable value from drop down which are greater then single element of array. ['5', '10', '15', '20', '25', '30'] // dropdown ['10', '15', '20'] // second array ...
0
votes
2answers
33 views

UK GB Post Code Zip Validation Magento 2 Space

I need some help with UK GB Post Code Zip Validation Magento 2 Space In that I want to force the user to enter spaces so its like this EC1A 1BB or W1A 0AX or M1 1AE so there must be space After the ...
41
votes
8answers
65k views

How To add JS file in frontend for all pages

I've read 3 pages of Google Results on how to load a JS file for all pages and still am not able to do it. I've got a few doubts, hope somebody can clear them out. Do I need to create a module ...
0
votes
2answers
362 views

Update billing address inserts javascript string in the address

when I hit update the billing address during checkout I get this string from legacy-build.min.js inserted into the address: function e(F,E){var D=0;try{this._each(function(H){F.call(E,H,D++)})}...
1
vote
1answer
9k views

Unable to resolve the source file for error in custom theme?

I am working on magento version 2.1.3 and have a custom theme shoppersbay. For some js files it gives error like Unable to resolve the source file for 'frontend/Smartwave/shoppersbay/en_US/...
0
votes
2answers
861 views

Magento2: Many .js requests. How do I merge js files?

I see over 130 requests to retrieve .js files, and I think it is a reason why the magento2 site is so slow. How can I optimize it? I've already set merge and bundle js files in admin, but it's not ...
1
vote
2answers
410 views

Get street address in checkout page magento 2?

Hello all I am trying to get selected shipping address from dropdown(without changing the dropdown option like getting selected shipping address when page loads) or default shipping address on ...
1
vote
1answer
44 views

how to add jquery on magento 2

I am using Magento 2, in my case I want to add an element after another using jQuery, can anyway tell me how to it, the best practice please For example i want to insert a div with class 'one' after ...
0
votes
2answers
1k views

Magento 2: Including External JS - Uncaught Error: Mismatched anonymous define() module

Trying to include an external JS file on a specific page. Currently using the following in my layout: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
2answers
1k views
3
votes
3answers
4k views

Uncaught TypeError: value.map is not a function coming from file-uploader.js

I am running Magento 2.2.3 When I try and go to admin/catalog/category/ and select a category it just spins and I get this javascript error. file-uploader.js:74 Uncaught TypeError: value.map is not ...
0
votes
0answers
9 views

Adding (complex) 3rd Party JS to Module

I'd like to add a large/complex JS file to my module. It's this: https://github.com/google/open-location-code From what I can tell, it's not being added at all. /app/code/Abc/Pp/view/frontend/...

1
2 3 4 5
43