Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 answers
8 views

Slow PageSpeed insight shows to many JS files - how to find page specific unneeded files

Google PageSpeedInsights shows a very long list of JS files if unbundled. I would like to reduce Magento 2 JS files using this tutorial https://www.codextblog.com/code-snippet/how-to-remove-unwanted-...
user avatar
0 votes
1 answer
9 views

call function inside ko.bindingHandlers knockoutjs

I'm trying to call a custom function inside the initialize ko.bindingHandlers function but getting the below issue. Message: Cannot read properties of undefined (reading 'tConvert') My code for ...
user avatar
  • 828
0 votes
1 answer
20 views

its my html form I have used Ajax in it. now I need to clear the data in the form after submitting it by pressing the submit button

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> &...
user avatar
0 votes
2 answers
16 views

How to delay a js script loading

One of my community modules is creating issues due to the fact he is loading too fast. When he is loading, the dom is not fully loaded yet. From : vendor/alma/alma-monthlypayments-magento2/view/...
user avatar
  • 772
0 votes
1 answer
21 views

Uncaught SyntaxError: Unexpected token < in JSON at position 0

Magento2 Error Uncaught SyntaxError: Unexpected token < in JSON at position 0 in the Ajax response $.get(url, function(data) { $('#load-more-loader').hide(); $('#load-more-product').show(); var ...
user avatar
  • 3,426
0 votes
0 answers
18 views

Knockout DateTime Picker - how to set custom Default Date

I have added a date-time picker in my custom form using the below code in HTML file. <label class="label">Delivery <div class="control"> <input ...
user avatar
0 votes
0 answers
21 views

How to show available data first then show the data respective to dropdown selection in Magento 2

<script type="text/javascript"> require(['jquery'], function($) { $(document).ready(function() { $("select").on('change', function() { ...
user avatar
  • 31
0 votes
1 answer
33 views

Remove special character from input form at checkout?

I'm trying to remove a dash ('-') from an input field (Zip Code) at checkout, but can get it to work. I want to clean just the initial character if a user enters the dash at the beginning of the zip ...
user avatar
  • 181
0 votes
1 answer
21 views

Owl Carsouel in Magento2

I am creating owl carsouel for compare products <div class="main-padding"> <div class="message-container"> </div> <div class="compare-inner-block "&...
user avatar
0 votes
0 answers
22 views

get result from phtml file to html

I have below code (which is at .phtml page) which echo store view selected and i want to take that value which is echo by below code and display it in an html page. please help how to do that. thanks. ...
user avatar
0 votes
1 answer
40 views

How i can pass js variable to php file?

i need to pass a variable from file.js to my model.php with rest API in particular get method
user avatar
  • 1
0 votes
2 answers
21 views

There has been an error processing your request: Error log record number: d11d948cb3596b359566fa162df65dbf6baef2446fe384f4476057675f3dd95f

Exception printing is disabled by default for security reasons. Error log record number: d11d948cb3596b359566fa162df65dbf6baef2446fe384f4476057675f3dd95f i run the record log number in putty this what ...
user avatar
1 vote
0 answers
8 views

Customize frontend and backend magento2 using js without using phtml file

Just to explain in simple words. I want to use the js file in the frontend and backend of magento2 but without using the PHTML file.Just directly usage by getting field name, or id or something.
user avatar
1 vote
1 answer
20 views

Insert child UI component inside existing one

I have 2 modules where each one has an UI component on frontend. Module A contains the main component and component of Module B should be displayed inside the component of module A. I'm not ...
user avatar
  • 96
0 votes
0 answers
13 views

Knockout - removing automatic focus from an input

in my project I have a UI Component written in knockout.js. The problem I've encountered is when overwriting ui-select.html even though I don't have any action anywhere that would cause this, when ...
user avatar
  • 27
0 votes
1 answer
23 views

Scripts and Stylesheets wont accept script?

Magento 2.3.3 I am inserting a script into the scripts and stylesheet section of my shop. As soon as there is a <script>...</script>, it wont add it. If I add the script without the ...
user avatar
0 votes
1 answer
22 views

What is the purpose of this Javascript method from module-catalog? price-box.js::reloadPrice

As the titel suggests. What is the purpose of vendor/magento/module-catalog/view/base/web/js/price-box.js::reloadPrice()? See: https://github.com/magento/magento2/blob/...
user avatar
  • 1,280
0 votes
2 answers
27 views

How to add script for checkout item default file?

how can I add script for Magento_Checkout/web/template/minicart/item/default.html file? I have to add data-bind="click: {}" to the product, but I don't know where I should place my function? ...
user avatar
  • 27
0 votes
0 answers
13 views

Cannot create property 'wishlist' on string '{"cart":1651213153}

I have create a custom extension ( Advanced WishList ), It is working fine in magento >=2.4.3 but giving below errors on magento 2.4.2 or less
user avatar
0 votes
0 answers
18 views

add to cart success message shows up only one time

the problem is client wants to fadeout the success message after few seconds by clicking add to cart button. i have made a change in addCartSuccessMessage.phtml file like this: <?php /** * ...
user avatar
  • 1
0 votes
1 answer
31 views

Magento 2: Translation doesn't works in JS files. Can anyone help on this please?

define( [ "jquery", "Magento_Ui/js/modal/modal", "mage/calendar", "mage/translate", ], function($, modal){ // also ...
user avatar
0 votes
0 answers
9 views

Extend magento's feature with java/react

I would like to use magento's logic to handle all the business logic related with ecommerce. However, I would like to extend it's functionality (some very custom feature that there are no plugins for) ...
user avatar
0 votes
0 answers
10 views

Handlebars is not defined error in Magento 2

How can we load handlebars Js library in Magento 2. I have tried Require JS XML Direct Script in html file. But none of these methods worked. Error in console Handlebars is not defined
user avatar
0 votes
0 answers
65 views

Magento 2.4.3 - JS mixin file not loading on each page load

I tried to overwrite Magento_Catalog/js/catalog-add-to-cart.js only to extend the submitForm method as follows: app/code/Vendor/Module/view/frontend/requirejs-config.js /** * Copyright © Onectus, Inc....
user avatar
  • 33
0 votes
0 answers
21 views

Magento 2: Create custom pdf

I want to create a custom pdf on button click. Currently I am doing it using the following code but it is conflicting with the other js on the page and causing errors: <?php /** * Copyright © 2017 ...
user avatar
1 vote
2 answers
78 views

Form validation is not working in my custom form in Magento 2

<div id="popup-modal"> <div class="contact-form-popup" style="display:none;"> <form class="form contact" action="<?= $...
user avatar
  • 31
0 votes
0 answers
25 views

How to show thanku message only after user submit the popup form in magento 2 until refresh the page

I have contact us buttons more than one in a page. when the user click on the contact us button i am showing the popup form. After user submitting the form i am showing thanku div.But when the user ...
user avatar
  • 31
0 votes
0 answers
12 views

How to create JavaScript widgets via Magento 2 APIs?

In the official Magento documentation, there's a section saying that we can create JS widgets in the admin and frontend using the APIs. "Create JavaScript widgets in the Magento storefront or on ...
user avatar
0 votes
0 answers
31 views

Magento 2 remove loader/spinner from the checkout input fields

in Magento 2 checkout page whenever we update or change any input field it triggers an ajax call with the loading spinner. I want to remove that loader spinner on the selected input field. But not ...
user avatar
0 votes
2 answers
55 views

Double curly brace problem

I created a frontend template page, my page has embedded some javascript. For some lines, I need to use the double curly brace. one of the line <a class='media' data-media-index='{{> ...
user avatar
  • 508
0 votes
1 answer
31 views

Component sometimes not loading - "Failed to load the "Vendor_ModuleName/js/view/minitest" component in Magento 2

We are launching a Magento 2.4.2 site, and finding that the site will sometimes load all of its Javascript components and dependencies properly, but sometimes fails to load on the custom component. In ...
user avatar
  • 26
0 votes
1 answer
10 views

keep scroll position when clicking on next page for category view M1.9

I am wanting to stop the page from returning on the top when a customer clicks on the pagination buttons for the category view pages. I have content at the top of the page for the category description ...
user avatar
2 votes
2 answers
107 views

A lot of js.map file not found after upgrade to Magento 2.4.3

I just upgraded my magento version to 2.4.3-p1, and after i login to the admin site there are a lot of js.map file not found in the console log message: How can i resolve this issue ?
user avatar
  • 48
0 votes
1 answer
28 views

Magento 2.4 - Add class for decimals in the price

I'm use Magento 2.4 and I need to change the format of the final price. I need to add a class for decimals. I want to add some css style to the decimals in the price. For example decimals must be much ...
user avatar
  • 2,064
0 votes
0 answers
10 views

How to use twentytwenty plugin in Magento 2

I want to add twenty-twenty JS on the product Page on a particular image. How that can be achieved? I am trying to do so in multiple ways but it's not working. Please guide. Thanks, Rashi
user avatar
0 votes
0 answers
13 views

Revolution Slider Auto Popup on Magento 2.4

I have this revolution slider link I am working with: <a href="#" id="clickme" onclick="document.dispatchEvent(new Event('RS_OPENMODAL_slider-2')); return false">...
user avatar
0 votes
0 answers
16 views

Swissup Slick slider is not working in Magento 2

In my magento website I am using Swissup slick slider. But its not autoplay infinite loop. Below is the widget I am using for the slider. <div class="testimonial-wrap"> <h3 class=&...
user avatar
  • 1
0 votes
1 answer
27 views

How can i move Strategery InfiniteScroll "Load More" button?

I installed Strategery InfiniteScroll to my Magento 2 project. The plugin provides an option to display a "load more" btn at the bottom of the listing page. However there's a problem. The ...
user avatar
0 votes
1 answer
26 views

Have issue with magento 2 not loading css and js on live site

Have this issue all css and js are not loaded on live site. Tried with terminal to do this. php bin/magento setup:static-content:deploy -f then php bin/magento indexer:reindex and in the end php bin/...
user avatar
0 votes
0 answers
8 views

Magento Redis sometimes the server just stop when I open console this problem Crbug non-JS module files deprecated

non-JS module files deprecated. When I restart the server and run the redis every thing work I don't know why this problem appear
user avatar
0 votes
0 answers
29 views

How to remove JS if it's defined in requirejs-config.js section "deps" of the parent theme

Have an interesting question. How can I get rid of js module changing files only in my current theme if js was required in the parent theme (this theme is used by other themes as a parent) In ...
user avatar
0 votes
0 answers
23 views

Payment Error : accept.js encryption failed. (E_WC_14)

We are getting the error for my site. May anyone knows why it is getting. Is it related to javascript? Any solution please Payment Error: accept.js encryption failed. (E_WC_14)
user avatar
  • 1,083
0 votes
1 answer
34 views

Grouped products, how to config childrens + increase and - decrease qty function correctly?

I have a problem with + increase and - decrease qty function. On 1 single click it goes up +2 or -2. It also do so on other children products qty inputs. How can I fix this correcly? \...
user avatar
  • 3
0 votes
0 answers
19 views

Extend Javascript function in another module

So, I programmed an extension, that adds a shipping function with a dropdown. It's working fine with the normal Magento checkout. Now I installed the one-step checkout from mageplaza. Of course, it ...
user avatar
  • 383
0 votes
0 answers
27 views

Private content for a JS script only, without rendering a HTML template

There is a lot of articles, blogs and stackexchange posts about inserting private content into a HTML template with knockout and data-bindings. And I know how to do that. But... How to use Magento2's ...
user avatar
0 votes
0 answers
50 views

Get Mini Cart Update Cart Button Event

I want to obtain the event during which this Mini cart update cart button is clicked I want to observe when and how many the amount of it being clicked I try to put below code inside app/design/...
user avatar
0 votes
0 answers
15 views

Override js method outside of returned object

I'm trying to override a js function initSidebar() in vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js I've been trying to use a mixin to do this but because this function is ...
user avatar
  • 1,180
0 votes
1 answer
23 views

Customer and Company Data displaying via Javascript (NO PHP)

I've tried researching this like crazy, and all I've come up with is PHP solutions.. which sadly, our Magento 2 site is managed by Magento Certified third-party, and I don't have access to play around ...
user avatar
0 votes
0 answers
21 views

x-magento-init sometimes not running

I have a shop developed in Magento 2.2. Now, I did a upgrade to Magento 2.4. I had to upgrade all the external modules in use. Everthing worked ok. But now, sometimes the $.widget called in my x-...
user avatar
  • 431
0 votes
2 answers
48 views

Custom Javascript not loded properly in magento2

Custom Javascript is not working with infinite scroll or after applying some filters from shopping options Working Fine with the first 12 products. but after applying some filters or working with the ...
user avatar

1
2 3 4 5
46