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
0
votes
0answers
29 views

Uncaught Error: Mismatched anonymous define() module: function(t,g,u)

I have a fresh installation of Magento but this error is showing on all of the pages.This may be duplicate of some other but I cannot find solution for my problem so asking here. When I trace back it ...
1
vote
0answers
15 views

How to add icons to input fields if the field has not passed validation

I need to add a custom icon to the floor if the field does not pass validation, as in the screenshot. I tried to implement this functionality with ':after' in CSS &._error .control input { ...
0
votes
0answers
11 views

Magento 2.3.4. This JavaScript error “Uncaught TypeError: Cannot set property 'status' of undefined” appears only on the configurable products

This error originates from the line data[l].status = 1,. Could you please someone point out what is wrong with this line? t(n).on("load", function() { **data[l].status = 1,** ...
0
votes
0answers
3 views

simple products dynamics price display base on tier pricing and quantity

Is there any reference that I can follow, so that my magento can update the price base on customer input quantity VS tier pricing. qty 1 = 10 each qty 3 = 8 each qty 10 = 5 each let say I have above ...
0
votes
0answers
6 views

Determine what Javascript is being run to implement a specific feature

I am looking to replicate a specific interactive frontend feature which is running on Magento 1, in Mageneto 2. I have no access to the Magento 1 admin to determine what extension is being used. I ...
0
votes
1answer
18 views

'getFormattedPrice' undefined on checkout

I need to get a list under each product in the form: - Unit price - Amount - Amount based on price and quantity Rewrite template: vendor/magento/module-checkout/view/frontend/web/template/summary/...
0
votes
1answer
25 views

Magento 2 : How to change html/css classes of onepage checkout in custom theme

I'm creating a new theme from scratch, I would like to change the html code of the checkout/#shipping page. However, the template (Magento_Checkout/onpage.phtml) containing the html code that I would ...
0
votes
0answers
26 views

Magento 2.3.4 theme use different logo file for mobile and larger screens

I need to use 2 different logo files, one for mobile and one for desktop view. I have one single custom theme (parent is luma) and I am wondering how to achieve this by using jquery and/or CSS. Is ...
0
votes
0answers
10 views

How to calculate the amount based on the number of elements on the checkout in the sidebar using knockout

In the block Your Order sidebar there is a block with the elements that are in the basket It has 2 fields price and quantity How to add one additional to these two fields, which is responsible for ...
0
votes
2answers
25 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-...
0
votes
1answer
20 views

Jquery get element with class name using get() function

I have code like this <ul class="tab-category"> <li><a class="a" > One </a></li> <li><a class="a active" > Two </a></li> <li>&...
0
votes
2answers
22 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 ...
0
votes
0answers
16 views

Magento 2 - How to use Ajax Auto completer?

I'm working on migration from Magento 1.9.* to Magento 2.3.* , in one of my phtml code I have this javascript Ajax.Autocompleter function, as I know this function is not available in Magento 2.3, how ...
0
votes
0answers
11 views

Cannot read property 'version' of undefined error while hard refreshing the page in magento 2

Whenever I am hard-refreshing the page, it displaying the below js error. jquery-ui.js:37 Uncaught TypeError: Cannot read property 'version' of undefined at jquery-ui.js:37 at mixins.js:87 at Array....
0
votes
0answers
14 views

Remove Shipping Step form M2 Checkout

I need to remove the shipping step from the M2 checkout. The shipping info will always be known as we are only going to allow a custom Store collection method. I realise I can disable the shipping ...
0
votes
0answers
27 views

Error when i add custom field to checkout

i have just started using magento2 (2.3.1) and WAMP (php 7.2.25) on Windows10, and i'm trying to add new custom fields to Checkout page.I'm following the ufficial doc and this question. I created: ...
0
votes
0answers
24 views

Magento 2 - Auto uptate cart total

In Magento 2, in the cart when I change the quantity or add product, the total price is refresh (to calculate shipping, taxes, ...). My goal is to disable the Confirm order button while the price is ...
0
votes
2answers
56 views

In Jquery, How to capture the data within <span>product_price</span> in the event of a change in the product price?

Below is the code written to capture the updated price from within <span class="price">Price</span> as the price changes on one choosing a variant of a product from the drop-down. I find ...
0
votes
1answer
38 views

Uncaught TypeError: $ is not a function

A function is created to be called when a change event occurs on a span tag as seen in the code snippet below. $(".price-box").on("change", ".normal-price .price-wrapper span.price", function() { ...
1
vote
1answer
29 views

How to eliminate the decimal point in the product price and add zeros based on the number of digits post period operator?

I need to ensure the product price either gets 0 appended to it with decimal point removed if there is only one digit after the decimal point or 00 appended if there is no decimal point. The logic I ...
0
votes
0answers
20 views

Wishlist page layout Magento 2

How would I change the customer wishlist page layout? It's currently in grid, how would I make it a list? Thanks in advance.
0
votes
0answers
16 views

Magento 2: Klarna tagline doesn't appear on the product details page

I'm trying to display the Klarna tagline in the product details page with Klarna already being integrated successfully into the site. The code that Klarna offers to be placed in the product details ...
0
votes
1answer
23 views

Uncaught SyntaxError: Unexpected token '{'

Everything looks fine with this small piece of code as shown in the screenshot. Yet, I am getting the syntax error around {. Please tell me what might be causing it?
0
votes
0answers
20 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 ...
0
votes
2answers
66 views

How to use responsive.js in a theme derived from Luma?

The Magento DevDocs says You can use the menu.js, responsive.js and matchMedia.js to add responsive behavior in your custom theme. If your theme inherits from Blank or Luma, you do not even ...
0
votes
1answer
43 views

Magento 2: How to insert a custom JS file in the header of custom theme. This custom JS file is placed in pub/media/pmm-custom directory?

I'm looking for a way to add a custom js file in the header.phtml file. I don't place custom JS file under theme_directory for a obvious reason. Could anyone please tell me how to override header ...
0
votes
1answer
24 views

How to provide and save data for custom field in gallery.phtm on product edit page

I have create custom field in admin product edit page image gallery popup in custom module with observer event. Now i want to provide data to this field from table ...
0
votes
0answers
7 views

Collapsed search box implementation magento 1

How to implement when clicking on the search icon collapse left input for search closed open in the file header.phtml exist method <?php echo $this->getChildHtml('topSearch') ?>
0
votes
1answer
20 views

Magento 2 How to observe cart price in JS Component

I want to show amount after which free shipping will be available in mini cart like below For that I override minicart.phtml in view/frontend/layout/defaul.xml like this <?xml version="1.0"?> &...
0
votes
0answers
14 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 ...
0
votes
1answer
28 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'...
0
votes
0answers
20 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 ...
0
votes
1answer
23 views

How to trace a JS function appeared out of nowhere in one of the Magento 2 category page?

one of the category page of our Magento site throws an JS error Uncaught ReferenceError: j$ is not defined. Upon investigating, this was found present with <script> j$('h1').hide(); </...
1
vote
0answers
8 views

Magento 2: Add 2 JS files in that depend on each other in checkout page

I tried to add 2 js files in checkout page using require-config.js from a custom extension like this: app/code/Vendor/Module/view/frontend/requirejs-config.js var config = { "map": { "*":...
0
votes
0answers
16 views

can't get the quantity for the product from the page 2 in ( pagination 2)

in my case i have a grid which displays the products by quantity , name , image ... , and also there is a pagination, for the page first page all works great i can get the quantity for the item, but ...
0
votes
0answers
20 views

Configurable product does not change the price at the front when choosing a product

My pricing template: /vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml My custom js file: /app/design/frontend/[Vendor]/[Module]/Magento_Catalog/web/js/...
0
votes
0answers
14 views

Advance JS Bundling

r.js -o build.js baseUrl=pub/static/frontend/Magento/luma/en_US_tmp dir=pub/static/frontend/Magento/luma/en_US I have checked whether this file jquery.hashchange.js exist or not so found It does not ...
0
votes
0answers
12 views

Call decorateList JS function in Magento 2

In Magento 1.9 i call decorateList js default function like this: <script type="text/javascript">decorateList('products-list', 'none-recursive')</script> How can i call this js function ...
0
votes
0answers
8 views

Magento2: How to add/get click function with DOM?

filename.js categoryClick: function(data, event) { var clickUrl = $(this).attr('href'); console.log(clickUrl); }, filename.html <div class="bottomWrapper"> <ul id="progressbar"&...
0
votes
0answers
13 views

Error when configurable option dropdowns load before product gallery

I have configurable products with two different configurable attributes in my store. I have a customization in vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js which ...
0
votes
1answer
25 views

Magento store optimization?

I am facing problem the total number of request send to server is 223 which is huge and due to which loading time is 13 seconds How can I reduce number of elements I have merged and minify JS and css
0
votes
0answers
15 views

Access uiComponent form data in javascript

I'm trying to create a button on my admin form that triggers a confirmation popup then redirects to a custom controller with the id of the current loaded entity in the form. From what I have read in ...
0
votes
1answer
26 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 ...
1
vote
0answers
14 views

Magento2 admin create order. Can we add Js variable to order object using config provider like frontend?

I am working on customization on creating order in admin and I want to access some product attribute in JS. I am looking for model from where I can set order object data and get by window.order....
0
votes
1answer
11 views

Where to locate requirejs-config.js on the home page of my Magento 2 site which uses a custom third party theme?

I wonder why Network tab in Browser Developers Tool Panel doesn't show requirejs-config.js at the top along with mixins.js, require.js. I am using a custom third party theme. When using Magento Luma ...
0
votes
1answer
18 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
0
votes
0answers
27 views

Using Mapbox JS with Magento 2.3.4 causing problems

In a custom module, I am using Mapbox js plugin for customized maps. https://www.mapbox.com/. In the extension, I included the js file using requirejs-config.js. But while calling the function in ...
0
votes
1answer
29 views

Magento 2: Properly access an external js variable in the checkout

Pure HTML Example I'm trying to do something as simple as the following html code: <button onclick="MyExtVar.run();">Run</button> <script type="text/javascript"> window....
0
votes
1answer
28 views

Execute script in copyright block?

For some reason, the little script we used to get the current year in the copyright block under Content/design/configuration/footer is not being executed. It is being treated as normal text in the ...
0
votes
1answer
13 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 ...

1
2 3 4 5
41