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
6 views

Magento 2.4.3 not generating *.min.js files

i am working a magento 2.4.3 the config (dev/js/minify_files) is set to 1. When i try to run the command bin/magento setup:static-content:deploy The script exit with the following error Error happened ...
user avatar
0 votes
1 answer
16 views

How to add a JS library and a JS script that makes use of that library?

I'm trying to use Chroma library in Magento and so far I did the following two things: Created a app/design/frontend/Vendor/Theme/requirejs-config.js with the following content: var config = { deps: ...
user avatar
0 votes
0 answers
19 views

Jquery code doesn't work when deployed but runs fine in the browser console in Magento cart page

We're trying to just display the text in the code below if the page is the cart page so that visitors are aware that they can add a gift message to their order. Code works fine by displaying the text ...
user avatar
0 votes
0 answers
8 views

How to develop frontend using React js Magento 2.4.4

I am stuck on react js integration and development in Magento 2.4.4 so anyone have idea then please share with me. Thank you.
user avatar
  • 498
0 votes
0 answers
11 views

shipping method auto select

Below is the picture of click n collect shipping method. if store view selected how to auto select in this drop down.
user avatar
0 votes
0 answers
19 views

$_SESSION that has been unset is saved back in magento with custom GTM (google tag manager) x GTM Weltpixel

I have some issue after add custom tag in GTM and setting configuration in magento by Weltpixel for GTM extension so, i have custom tag for tracking event login, logout, banner click, brand click, etc ...
user avatar
  • 101
0 votes
1 answer
15 views

how to get the return of an ajax request that I didn't send

there is a request that is being made on the site, but I didn't make this request, but I need to get the result of it. Is there anything I can do?
user avatar
  • 197
0 votes
0 answers
13 views

Magento2 how to get a fully functional slider?

I've got this issue with the slider of the related section in the product page. I'm in Magento2, using Tailwind.css and Alpine.js I've created an apposite .phtml file to have different blocks for ...
user avatar
  • 3
0 votes
0 answers
17 views

How to implement the Swiper slider in Magento 2

I am new to Magento 2, so I don't understand how to implement the swiper carousel in Magento 2, instead of the swiper carousel I can understand how to implement the owl carousel, and its working fine ...
user avatar
-2 votes
1 answer
15 views

How to solve this error ? menuAim is not a function

Error: at HTMLDocument.<anonymous> (mega-menu.js:41:28) at fire (jquery.js:3238:32) at Object.fireWith [as resolveWith] (jquery.js:3368:8) at Function.ready (jquery.js:3588:14) ...
user avatar
0 votes
1 answer
33 views

Magento 2 Admin Error using Mirasvit Push Notifications

Having installed the Mirasvit Push Notification. when I am editing a block in the admin backend, I get the following error in developer tools and I cannot save/update any changes. In Chrome: Uncaught ...
user avatar
0 votes
1 answer
31 views

Show "Cash on delivery" method for AZ state using payment-service.js mixin

I am stuck. Can someone please correct my code? define([ 'underscore', 'Magento_Checkout/js/model/payment/method-list', 'Magento_Checkout/js/action/select-payment-method', 'mage/utils/wrapper', '...
user avatar
0 votes
0 answers
14 views

trying to add custom module js in third party module layout giving error -> Mismatched anonymous define() module: function magento 2.4.2

guys im working on a third party module which replace the body of the page when you search anything, the problem is that after that module replace the body, some js files are missing causing other ...
user avatar
0 votes
1 answer
46 views

How to stop Playing video in the background when popup modal is closed or click on out side of the popup

I have a button. When user click on button i am showing the video in popup modal. But when i click on outside of the popup the popup is closing but video is keep playing and when i close the popup ...
user avatar
  • 33
0 votes
0 answers
16 views

How to condition check a product attribute in a JS Mixin?

Using Magento 2 I am trying to do a condition check on a mixin I created for the update function on the mini-cart. The code looks like this: define(function (customerData) { 'use strict'; ...
user avatar
0 votes
0 answers
9 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
26 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
23 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
45 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,446
0 votes
0 answers
22 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
23 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
  • 33
0 votes
1 answer
45 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
23 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
23 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
94 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
  • 3
0 votes
2 answers
33 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
9 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
28 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
21 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
40 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
28 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,279
0 votes
2 answers
51 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
15 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
58 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
41 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
13 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
33 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
171 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
25 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
224 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
  • 33
0 votes
0 answers
33 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
  • 33
0 votes
0 answers
18 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
40 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
96 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
  • 518
0 votes
1 answer
66 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
12 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
196 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
  • 68
0 votes
1 answer
32 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,066
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

1
2 3 4 5
47