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.

835 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Only Load required js scripts on particular page

Hi we have a custom theme where i have examined that only 16 js files are required on that page but the magento loads up 298 scripts which slows the home page speed. so i want to know is there a way ...
Pramod's user avatar
  • 1,464
0 votes
0 answers
156 views

Magento 2 JS issue

on my Magento 2 I use Porto latest theme version. Sometimes language and currency drops dont work. I must always restart page to fix. I got following JS error Uncaught SyntaxError: Unexpected end ...
Sharafiddin Nosirov's user avatar
0 votes
1 answer
76 views

how to use js and css in custom module in magento 2.3.5

I want to use css and js in custom module, I want to create collapse tabs in magento so anyone can have idea please share with me. Thank you in advance.
Deep Shah's user avatar
  • 565
0 votes
0 answers
26 views

Change cart qty from onestep checkout

I need to change cart qty via js while on the /checkout page(not in /checkout/cart). Then start the checkout process again with new data. Is this possible?
Kawafu's user avatar
  • 1
0 votes
2 answers
642 views

How to use reactjs with magento 2?

I want to use reactjs in my magento 2 module for designing or developing PWA. edit:- how to integrate jqery with magento 2
Navneet Gupta's user avatar
0 votes
1 answer
338 views

JS VarienForm in Magento 2

Is there a way to update this code to work with Magento2? I believe VarienForm has been depreciated in Magento2 but I can't find a similar JS constructor to get the object. var AddToCartForm = new ...
Sam's user avatar
  • 163
0 votes
0 answers
325 views

Magento 2 checkout loader is stuck

I've seen this question a couple of times, but i wasn't able to solve my problem. My checkout page loads fine but the "loader" gif doesn't go away and I can't interact. Usually refreshing ...
user70508's user avatar
0 votes
1 answer
660 views

Magento 2 - Custom Module JS error

I am trying to add custom js file using my custom module. But getting below error in console. Uncaught ReferenceError: Plyr is not defined DevTools failed to load SourceMap: Could not load content ...
Nayem323's user avatar
  • 751
0 votes
1 answer
30 views

Javascript error productSidebar.js Magento 2.3.3

i'm using Magento 2.3.3, and in my catalog's console i found this error in pub/static/ there's no a folder named "version.." but if you skip that folder you can find directly "frontend/AtelierVM/.../...
Stage Softweb's user avatar
0 votes
1 answer
1k views

How to add a required checkbox to checkout page (policy check)

I know that there is basic functionality, but it does not suit me. How to display my template under the form with the link to the privacy-policy page? Or tell me how to do it right. I need a ...
ann karsksya's user avatar
0 votes
1 answer
138 views

How to add a green border if validation is completed when submitting the form

Magento 2 has basic validation if the field is not valid. How to add custom validation to the checkout page which will add a green border and an inscription that notifies the user of a successful ...
ann karsksya's user avatar
0 votes
2 answers
115 views

how to overwrite a JS file in magento?

I want to replace this JS. \vendor\magento\module-catalog\view\base\web\js\price-options.js I did try override by \app\design\frontend\(vendor)\(theme)\Magento_Catalog\view\base\web\js\price-...
Paul Fan's user avatar
  • 654
0 votes
2 answers
37 views

Magento2.3.2 js and css not getting applied on frontend

I have a site in magento 2.3.2. My code is getting fetched from var/view_processed instead of directly from app/code and app/design. See https://prnt.sc/slkvss The css and css also not getting ...
Nafsss's user avatar
  • 760
0 votes
0 answers
282 views

Magento2: How to output the contents of an entire JS file into a phtml file?

I defined a function in a block class as below to return the contents of an entire custom JS file, the path of which is stored in $absolute_custom_js_file_path . What is the right PHP function to be ...
CodeForGood's user avatar
0 votes
0 answers
55 views

Store external API expire time in Custom Module

I use ajax to get the access token from the external API. How can I store the expired time across the site and the ajax only call again when the session expired? test.js /helloworld/index/display is ...
Tony Le's user avatar
0 votes
3 answers
2k views

Cannot read property 'bind' from copy of mage/menu.js

I am trying to create a custom menu in Magento 2, but I run into the following browser console error when I add the JavaScript file for it. main.js:27 Uncaught TypeError: Cannot read property 'bind'...
Holly's user avatar
  • 4,873
0 votes
1 answer
81 views

How to load an external file to load and execute our custom JS files on the Magento site?

seeking some advises. My Magento-2 project has 2 custom JS files that I would like replicated and loaded externally on the site. This arrangement is for our client to use them to add his own code ...
CodeForGood's user avatar
0 votes
1 answer
2k views

Youtube video still playing after modal is closed--and I've tried every fix known to man with no luck!

I'm having an issue with Youtube continuing to play after closing a modal. I know this is not a unique problem and I have done exhaustive research to find answers. Unfortunately nothing has worked. I ...
Amanda's user avatar
  • 1
0 votes
1 answer
48 views

After merge css and js files are turned on, the files remain not contiguous

After turning on merge of css and js files in System > Configuration > Developer and clearing the cache, files are not merged The request numbers do not change
Alice's user avatar
  • 148
0 votes
1 answer
653 views

JS files are not updating in Pub/Static Folder and JS files are also not listing in Source tab of crome in Magento 2

I am trying to change the code of JS file in my module but it's not updating in the pub/static folder. when am I checking the source tab of crome it's also not listing under it. I am following the ...
Sarvesh Tiwari's user avatar
0 votes
1 answer
265 views

JS gets automatically removed from CMS page

I am trying to add some JS to the CMS homepage. I tried to add an external js file as well as adding the code directly. See code below. When I save the CMS page and test everything the js works fine. ...
Chaz's user avatar
  • 269
0 votes
0 answers
523 views

How to take Product attribute value and pass in JS?

I want to get attribute value which is date and wants to pass it into JS file, I have my JS files linked up properly, basically I am displaying timer in product detail page and I want to display timer ...
Jaymin's user avatar
  • 155
0 votes
3 answers
4k views

How can i filter custom atributes in graphql?

I am building an e-commerce app to sell products. There is a section in my website with products on sale and I want to show in this section just the products that are on sale. But in the backend of my ...
Gutro's user avatar
  • 1
0 votes
0 answers
71 views

Advanced JS bundling: Some dependencies already included under certain JS Bundle are loading separately

I am facing an issue with some dependencies that were already included in some bundle are loading separately as seen in the browser console. Could you please share yours insights into this? Please ...
CodeForGood's user avatar
0 votes
1 answer
324 views

setup:staitic-content:deploy doesn't update JS in Magento 2

I'm running Magento 2 in production mode. I made some changes in my module JS files. I try to make the JS change reflecting on the live site, by using following command. php bin/magento setup:...
Sarvesh Tiwari's user avatar
0 votes
1 answer
169 views

Magento_Catalog Custom Gallery customization event

What event do I have to listen for in Javascript to detect that the user has changed the customization in a customizable product? I am working on a custom gallery for my product page, but i am ...
Manak Kapoor's user avatar
0 votes
0 answers
147 views

I have added a js files in pub/media/custom.js is not updating on frontend in magento 2

I have added JS file in pub/media folder and put permission of 777. and given link in content->design->configuration-website <script type="text/javascript" src="https://#/pub/media/custom.js">&...
Sarvesh Tiwari's user avatar
0 votes
1 answer
130 views

jquery in how to get the children without tag id using?

j query in how to get the children without tag id using ? i have using table structure to get the children but last children not getting. I have try this Code $(document).ajaxComplete(function (...
SUDHAKAR ARUNACHALAM's user avatar
0 votes
1 answer
128 views

Magento 2.3 Javascript widget get defaultqty

I want to extend a js widget that applies plus minus buttons. Is there a way to get the defaultqty of a product inside the widget? ;(function ($, window, document, undefined) { $.widget("infortis....
Jilco Tigchelaar's user avatar
0 votes
2 answers
316 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 ...
wertherhiggs's user avatar
0 votes
2 answers
66 views

How to add 3 templates to custom tabs

I have 3 blocks that are in the cms block and displayed on the cms page. How to place each block in a separate custom tab Tabs stretched to full page 3 templates: app/code/Qqq/Wwwww/view/frontend/...
ann karsksya's user avatar
0 votes
0 answers
248 views

Product page Image Gallery Loading Issue

I'm getting images of product and using custom slider to load the product images in product details page, The product is loading normally but sometimes when we refresh the page, Images wont showup. ...
rakcode's user avatar
  • 123
0 votes
0 answers
75 views

Magento 1.9: JS File in browser does not change

I'm using extension Cm_RedisSession to enable Redis, when i change a js file in media/js folder, and when I reload the browser it still didn't change, i already did these: Delete var/cache , var/...
jojo's user avatar
  • 39
0 votes
2 answers
349 views

cannot find my custom js file

I have created under app/code/vendor/theme/view/frontend/layout/defaul.xml an file called default.xml and i have following content in it: <?xml version="1.0"?> <page xsi:...
marijanovic's user avatar
0 votes
1 answer
997 views

Map multiple js files in requirejs

I want to include yahoo.js and yahoo-calendar.min.js from my custom module yahoo.js yahoo-calendar.min.js basically i need to call the function from yahoo-calendar.min.js which require yahoo.js ...
jojo's user avatar
  • 39
0 votes
0 answers
731 views

Custom service worker

I'm trying to implement a notification system on my website. So I'm trying to register a service worker, and I can't seem to make it work. I've created a module with the following layout : default....
Badong's user avatar
  • 91
0 votes
1 answer
377 views

Magento 2 - How to translate JS form errors?

In Magento 2, I try to translate Javascript messages "This is a required field." In create account form : I selected Spanish language but javascript errors are not translated, they appears in ...
Fbr's user avatar
  • 157
0 votes
2 answers
1k views

Magento 2 how to show background shadow while open menu?

** like this reference website https://www.colorland.com/uk/ when we click on menu its showing shadow background black on body. i have tried with custom JavaScript i have applied custom JavaScript for ...
zeshan rahman's user avatar
0 votes
0 answers
39 views

Magento 2 Import CSV File upload option dissapearing

Magento 2.2.2 I am trying to upload a csv file for an import. However when I select Entity Product the option for uploading the csv in admin dissapears. I have tried resetting permission for ...
jt9489's user avatar
  • 175
0 votes
0 answers
141 views

How to rewrite jquery code in jquery ui widget

How to remake this code in ui jquery widget? There is such jquery code. When you select an item using the checkbox, the item is cloned and added to another block. Tell me how to rewrite it in jquery ...
ann karsksya's user avatar
0 votes
1 answer
195 views

Magento 2 how to add Materialize javascript in Magento 2?

I have tried to add materialize js to Magento 2 but it does not work. I have my materialize js in theme/web/js. then I have the requirejs-config.js in theme/ this is the code: var config = { //...
Oscar Vazquez's user avatar
0 votes
1 answer
919 views

how to add custom js to end of footer on every page

I want to add a custom js file to all pages before the footer i want to pass script through phtml Is it possible to do this?
jibin george's user avatar
0 votes
2 answers
2k views

Magento 2 How to show success message after product add to cart on home page?

How to show success message after product add to cart on home page like this "You added product-name to your shopping cart." I am using that code on template file - <form data-role="tocart-...
sumeet bajaj's user avatar
  • 1,296
0 votes
0 answers
153 views

Magento2: How to use checkbox in model popup in js?

I have created a model popup, that will appear when user click on add to cart. Now I want to add check box to accept user acceptance by click on checkbox. Can someone please help to to do this .
Purushotam Sharma's user avatar
0 votes
2 answers
2k views

get product id from item id in magento 2

I am trying to retrive product id from item id. i created first js function in sidebar.js: define([ 'jquery', 'Magento_Customer/js/model/authentication-popup', 'Magento_Customer/js/customer-data', '...
sam's user avatar
  • 489
0 votes
1 answer
456 views

How to Override Magento Add to WishList Widget

I want to Override Magento add-to-wishlist data-action in Magento 2 i Have Created and Override Core addtowishlist Widget in my requirejs-config.js var config = { "map": { "*": { ...
User 69's user avatar
  • 145
0 votes
0 answers
639 views

Magento 2.2 display brand logo product detail page

Please can someone provide step by step instructions or provide tutorial on how to display brand logo on product detail page above the add to cart button. Thanks
jt9489's user avatar
  • 175
0 votes
1 answer
805 views

Submit checkout form with JS after processing payment on checkout page only

I've integrated some custom payment module. I am getting trouble with form submission with JS after payment response. I need to submit the checkout form on click of place order but with JS and that ...
Garry's user avatar
  • 145
0 votes
1 answer
99 views

How can I add critical JS on Magento 2.3.3?

Magento 2.3.3 has "Move JS code to the bottom of the page" function which moves all JS code to bottom of the page. I need some JS code(Seal Verification Code which showing verification icon) not ...
Pejman Sufer's user avatar
0 votes
0 answers
2k views

Uncaught (in promise) ReferenceError: object is not defined on checkout page

JS object is not defined on the checkout page. Already included the script on the checkout page. Exactly the same thing is working on a simple Html page. but creating some issue on magento2.
Garry's user avatar
  • 145

1
10 11
12
13 14
17