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.

657 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
61 views

Adding custom JS to existing module causing errors

So I've been trying to add some custom javascript to a module, however when the JS has added it works fine in itself, but it causes a lot of errors for a lot of different scripts, and I can't figure ...
0
votes
0answers
230 views

Magento 1.9.3.8 - Uncaught TypeError: Cannot read property 'get' of undefined

I always get this JS error but I read something that can solve it by un-commenting a statement in a layout.xml, Is there somebody who can tell me about it more specifically? Unfortunately my store ...
0
votes
0answers
13 views

How can i change a plugin di.xml with javascript?

How can I override a custom plugin di.xml with javascript in Magento 2? If I click "x" button use di.xml else click "y" button use di2.xml? di.xml content <?xml version="1.0"?> <config ...
0
votes
1answer
15 views

Extend/Override Javascript Included from Layout (head->link)

I want to extend: vendor/magento/module-catalog/view/adminhtml/web/js/edit-tree.js Which is loaded by layout: vendor/magento/module-catalog/view/adminhtml/layout/catalog_category_edit.xml:12 Why I ...
0
votes
0answers
44 views

How to get configurable product stock quantity inside swatches-product.js file

Need to add option data attribute for configurable products. Product.Config.prototype.loadOptions = function() { this.settings.each(function(element) { element.disabled = false; ...
0
votes
1answer
33 views

How to get rid of browser caching issue of javascript file in magento 2

After our magento 2 site is live whenever we are doing changes in JS file it doesn't reflect in customer browser as a result some of the pages breaks for those customer who doesn't flush his browser ...
0
votes
0answers
38 views

Magento 2: Failed to load resource: the server responded with a status of 404 (Not Found)

I am trying to override magento 2 core js ' require-config.js file at path Test/JsOverride/view/frontend/ var config = { "map": { "*": { "menu": "...
0
votes
0answers
33 views

Why is guest customer billing information NULL - Magento 2 checkout and quote?

I'm trying to get guest customer billing information during the checkout session as I need to save it to the quote before redirecting to placeOrder but the billing information is always null. How do ...
0
votes
1answer
55 views

How to fix blank Minicart popup in custom navbar for Magento 2

I am creating a custom theme from the parent theme Luma. I've added this code to Magento_Theme/layout/default.xml to include the minicart. <block class="Magento\Checkout\Block\Cart\Sidebar" name="...
0
votes
2answers
156 views

menu.js:1 Uncaught TypeError: require is not a function

I am trying to add a jquery script to my site. I have updated the require-config so it has this- var config = { paths: { slick: 'js/slick.min', slaask: 'js/customscript', menu: 'js/menu....
0
votes
0answers
42 views

Social login popup on custom url

We have installed Mageplaza social login popup(https://github.com/mageplaza/magento-2-social-login). The extension opens the popup when clicked on "Signup/Login" button on the home page. We need a ...
0
votes
0answers
69 views

Magento 2.3.1 not allowing javascript code

I am setting up my store on latest Magento 2.3.1 CE edition. Apache version: Apache/2.4.39 PHP version: 7.2.18 MySQL version: 10.1.40-MariaDB. Also I am using Porto theme. There is a strange ...
0
votes
0answers
27 views

How to send a javascript variable to a PHP file in Magento project?

I have this file that contains a javascript variable: src/app/design/adminhtml/default/default/template/smv/order/sales/creditmemo/refund.phtml <p> <select name="creditmemo[reason]"> ...
0
votes
2answers
170 views

Magento2.3.0 :When merge and minify js and css after set production mode not working my admin panel and frontend css lacking

I am using Magento2.3.0 community version When merge and minify js and css after set production mode not working my admin panel and front end css lacking if any one know what is actual issue reply me ...
0
votes
0answers
70 views

Magento 2.3: How To Initialize Js…?

I'm new to Magento 2.3, I was trying to apply jQuery DataTable and it's done, after that, I want to add it's Button Extention, for that i need to add two more js,so i initialize it, now i'm getting ...
0
votes
0answers
26 views

Error displaying the product name in magento 1.x

I'm having an error displaying the product name. if it is "dog" English then it will appear in the frontend. If it is Vietnamese "dog" it will not display. I am doing it in js file. Other products ...
0
votes
2answers
174 views

Magento 2 | VueJs Framework

Is there a way to use VueJs Framework under Magento 2 ?
0
votes
0answers
18 views

Magento2 How do I see the raw files, I'm just on the admin

I'm very new to this, I'm doing this for a client. I see there is a content section where I can edit the blocks. I suppose I can edit the custom js to add a javascript file to call my API. I'm try to ...
0
votes
0answers
28 views

Magento 2 Assign customer group name to externally calling JavaScript file variable

PreRequisites: MageVersion - Magento 2.3.x External JavaScript - http://domain.com/external-js.js var mage_customer_group = ''; //other code related to the customer group Pages - Category page and ...
0
votes
0answers
63 views

Magento2 add js custom conversion tracking on thank you page on first time load

I'm editing a client's site and I need to add custom javascript for our purchase tracking, on a success or thank you page. Oh shopify we put it on the checkout input box custom script input window ...
0
votes
1answer
246 views

How can active accordion tab on click

I want to active an accordion tab on button click with activate() method https://devdocs.magento.com/guides/v2.1/javascript-dev-guide/widgets/widget_tabs.html#fedg_tabs_methods-activate This is my ...
0
votes
0answers
134 views

Magento 2 + NGINX + REDIS + VARNISH + SSL Changing to Developer mode

in Production Mode everything is fine. When i change to Developer Mode i have this Problem because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is ...
0
votes
0answers
30 views

Language and currency switcher js error

Added language and currency switcher to template using this below layout. <block class="Magento\Framework\View\Element\Template" name="store.settings" group="navigation-sections" template="...
0
votes
0answers
27 views

JS Errors after changing deploy mode developer to production

I simply change my application mode form developer to production. php bin/magento deploy:mode:set production Result- Deployment of static content complete Disabling maintenance mode Enabled ...
0
votes
0answers
156 views

JS Error after adding bootstrap 4.3.1 files in magento 2 custom theme

ERROR Uncaught TypeError: jQuery.ajaxSetup is not a function at jquery-migrate.js:301 at jquery-migrate.js:521 (anonymous) @ jquery-migrate.js:301 (anonymous) @ jquery-migrate.js:521 require....
0
votes
0answers
10 views

Bundle label display

How do I display a label overlay for thumbnails, on bundle products? Is this difficult or should I find a extension. Thanks for help. Best regards Martin
0
votes
0answers
22 views

Return PHP values inside JS file

I have an module that I need to load some informations when the user clicks at the sync button (backend). The problem is, how to retrieve the values from the js file and put them in the form. view/...
0
votes
0answers
54 views

Override RequireJs Config

So as we all know Magento has always had a massive js overhead, I'm trying to reduce some of this by removing some unnecessary scripts. I know how to override a script or extend one, but how do I ...
0
votes
1answer
29 views

JavaScript Change in custom module not refreshed by deployment

I am going crazy right now. I made a change in a JavaScript file in a custom module which is installed via composer from my own repo. But I can't, under any circumstances, get those changes reflected ...
0
votes
1answer
48 views

Minify CSS Magento 2

It possibile to fix this issue? Where is the file that i can minify? How can i find it? Thanks :) Magento 2.2.2 CE
0
votes
0answers
34 views

Magento 2 paytabs Uncaught TypeError: Cannot read property 'removeAttribute' of undefined

We are using official paytabs extension - https://dev.paytabs.com/docs/magento/ but getting below error at checkout "Uncaught TypeError: Cannot read property 'removeAttribute' of undefined" Is ...
0
votes
0answers
42 views

how to get configurable product id in cart item in magento 2 using js

I want to get the configurable product_id in cart. My Questions 1) I want to get configurable product id using js 2) Also get product attribute values in js
0
votes
0answers
40 views

Defer parsing of JavaScript Magento2

Hello is possible to fix this issue? I know that are external js.
0
votes
0answers
45 views

Include js in select option on phtml magento 2

I need to add the js code which is in script tag in select option on Form.How can i achieve this. <select name="bcity" id="typeOfGlass" class="form-select-dashboard" placeholder="Pakistan"> &...
0
votes
1answer
63 views

Minify inline javascript in magento 2.1 EE

I found a solution to minify javascript using the following link https://gist.github.com/lewisp6/b7c50b4d82ef4d3d5d6dc888e8d1bdba At what path should I place this script?
0
votes
1answer
211 views

Magento 2 how to add a Javascript addeventlistener to element

I am trying to add an event listener to an element, but no matter what I try, it won't work. Here is what I have so far (this is in the html web templates page): window.addEventListener('load',...
0
votes
1answer
615 views

Magento2 : Save Button Not Working in Admin Form Custom Module

I am Working on A magento 2 custom Module i have a Form as well a Product Grid in my form so i created tabs using block but Whenever i click on save button gives me Javascript Error TypeError: $....
0
votes
1answer
215 views

TypeError: stepNavigator.setHash is not a function in checkout Magento 2

TypeError: stepNavigator.setHash is not a function I have a javascript error in the console like above, because of this error some shipping method is not showing properly. Can anyone please tell ...
0
votes
0answers
59 views

Magento 2.3 - While in backend i get js error “cannot read propery map of undefined” then logs me out of backend

TypeError that is happening and it doesnt happen on a specific page. it happens throughout the backend and then logs me out.
0
votes
0answers
162 views

Magento 2 - js mixin

I am trying to overwrite some methods from my original js file. My original file path is: app/code/vendor/theme/view/base/web/js/file.js. In my file-mixin.js file I want override few things from ...
0
votes
0answers
155 views

Magento2 : How to disable days and dates in same beforeShowDay function?

In js file how to disable both date and day in same beforeShowDay function To Disable Specific days beforeShowDay: function(date) { var day = date.getDay(); if(disabledDay.indexOf(day) > -...
0
votes
0answers
32 views

How to do password validation part without form (Magento 2)

I have a form which has password change functionality, the issue for a change I wrote my own controller and I change the button to type = 'button' from submit. Now how can I validate the password? I ...
0
votes
1answer
479 views

Product detail page image not loading on front end

Product detail page images are not loading. The pointer is just spinning. I have read lots of threads. Clear cache, reindexed, change permissions. Finally, I got a problem. but unable to fix it. :-/ ...
0
votes
1answer
176 views

Why Magento2 not loading css and js files in local setup?

my root folder .htaccess file RewriteOptions inherit # php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php71” package as the default “PHP” programming language. <IfModule ...
0
votes
0answers
10 views

How to translate a jas message magento 2

I want to translate this message to english but i can't find a way please help me $("#nbr-pieces-tot").html(nb_prod + chaine_selected+" X "+nbre_pieces_par_caisse +" pièces = "+ nb_piece_tot +' ...
0
votes
0answers
35 views

Magento 2 Add js from my own theme to every page with Miscellaneous HTML

In Content -> Design -> Configuration -> Footer -> Miscellaneous HTML, I can add javascript files like this just fine, <script type="text/javascript" src="http://example.com/myjavascript.js">&...
0
votes
0answers
54 views

Magento2: how to add/remove a form field using javascript

I have created a custom form in admin in which I need to show buttons such as "Add more" and "Remove". The scenario is exact that which is discussed here: https://stackoverflow.com/questions/...
0
votes
1answer
15 views

Magento 2.2.7. Best way -according to the Magento guidelines- to apply some custom javascript to specific products

At app/design/frontend/Custom/Theme/Magento_Catalog/templates/product/list.phtml I'm trying to apply a javascript for certain products (not all of them) as follows: <?php foreach ($...
0
votes
1answer
81 views

Show and Hide Product Grid in custom module Magento 2

I have created a drop down field. When I select 1 option from field I want to show the another field and along with that I want to hide product grid. Same as when I select 2nd opinion, I want to show ...
0
votes
0answers
25 views

Magento 2 implement Readmore.js from jedfoster

I want to implement Readmore.js to our Magento 2 store. See: https://github.com/jedfoster/Readmore.js For some reason it does not work, maybe due to conflict jQuery with default Magento 2 code? Is ...