The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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

Magento2: gZip compress third party JS/CSS/Image files

I want to gZip compress third party JS/CSS/Images files. Example https://www.google-analytics.com/analytics.js Please help me in this.
0
votes
2answers
68 views

Slick slider is not working in Magento 2

We have integrated the slick slider on Magento 2. But, the slider is not working. I have checked the console and see there is no error. I'm not sure where am i wrong. Code in Template file: <...
1
vote
1answer
589 views

Password Strength Meter - Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

I have an issue where the password strength meter on the reset password page isn't working and just says "Password Strength: No Password". I receive the following console error when I enter text into ...
1
vote
2answers
12k views

how to add expires headers in magento [closed]

I analyzed my website on Gtmetrix.com for optimization and the result was this: There are 4 static components without a far-future expiration date: http://www.someextensionsite.com/widgets/v1.0/...
1
vote
1answer
23 views

How to add a JS Component via XML?

How could I add a new JS Component, using required and following the Magento's pattern via an XML which I can determine a unique page (e.g. using a checkout_index_index.xml) I don't want to create a ...
0
votes
2answers
46 views

Magento 2: How to load my custom js file after footer?

JS File Path: web->js->swap.js default_head_block.xml <referenceContainer name="before.body.end"> <block class="Magento\Framework\View\Element\Text" name="swapjs"> ...
0
votes
2answers
24 views

How to add custom JS file?

I have created a custom module for Megamenu. I have js file which needs to be added to this module. Some of my queries are: Can I add the js file directly on my module?. If yes, how to do it? Do I ...
0
votes
0answers
37 views

How Can I add Any jQuery Plugin in Magento 2.3.0

I am trying to add owl Carousel js file in app/design/frontend/My/theme/web/js/carousel.min.js but I am unable to add it to my site header.
0
votes
0answers
24 views

Show div based on drop down value

Somethings missing and I can't figure out what. I just need to show a div when the drop down Canada is selected. JS code is at the bottom of this. Any ideas? Thanks <div class="field" data-bind="...
0
votes
2answers
33 views

How to call function from another function using magento knockout js?

I need quick help regarding calling a function within a function using Magento knockout js, I have tried this define([ 'ko', 'uiComponent' ], function (ko, Component) { 'use strict'; ...
2
votes
1answer
595 views

Update price without refresh the page

I am working on magento2 customization calculation functionality. In this i have width and gather two field is there in text field I have to calculation with product price eg. pricewidthgather like ...
6
votes
2answers
96 views

Magento 2: Pass variable from phtml to js

here is my layout <referenceContainer name="minicart.addons"> <block class="Vendor\Mymodule\Block\Cart\Sidebar" name="shipping_bar" template="Vendor_Mymodule::cart/minicart.phtml"> ...
0
votes
0answers
13 views

Add custom checkout funnel tracking to onepage checkout

I want to build a custom analytics module for yet another analytics service. The service tracks standard checkout funnel - user enters an address, user select shipping option, user click the pay and ...
0
votes
1answer
434 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
2answers
47 views

How to load JavaScript after Ajax has loaded?

I have a custom payment module and I am trying to show a message on the payment page using jQuery. My JS file is being called on the shipping page but not when the user clicks on the next step and ...
5
votes
1answer
1k views

Magento 2.2.1 Checkout page broken and Js fail to load error

I have installed Magento 2.2.1 and set up my custom theme but checkout page looks broken and consoles showing errors: Not sure how to resolve this issue. Need help how can this be resolved. How ...
1
vote
1answer
811 views

Magento 2 How to call a ajax function in x-magento-init type javascript?

It seems cannot use jquery lib inside the x-magento-init type javascript. How to call a ajax function in x-magento-init type javascript? Thanks
0
votes
1answer
882 views

Linking on button and open custom tab

Need to open custom tab on product view, from link. Magento 1.9.2.4 Custom theme. My tab, which is added just in one category by Custom Design <reference name="product.info.tabs"> <...
0
votes
1answer
38 views

I am getting Uncaught ReferenceError: require is not defined

please anyone can help me here, I am getting the require undefined in js, below is my code. Thank you <script> require([ "jquery", "mage/...
0
votes
0answers
15 views

How to resolve require is undefined issue (caught ReferenceError: require is not defined)

I am getting an issue on a single page (caught ReferenceError: require is not defined) on the below code. Please help me to resolve this issue. I am not sure where I am getting this issue I inspected ...
1
vote
5answers
3k views

How to disable JQMigrate Logging

We keep receiving this log and stack trace from JQMigrate, but it seems to just be a warning. Is there a way to just straight up disable logging in production?
1
vote
2answers
1k views

data-mage-init not working on CMS page

If I add this to a CMS page then it pull in the javascript to the page correctly: <script type="text/javascript"> requirejs(['jquery', 'bootstrap'], function (jQuery, jQueryBootstrap) { ...
0
votes
2answers
2k views

How to Magento 2 Enable JavaScript Bundling

I merged JS and CSS file Stores -> Configuration -> Advanced -> Developer -> Javascript Settings in production mode of magento2. Once, I check via view source of the page, I can see the Javascript is ...
1
vote
0answers
37 views

Magento 2: Autoplay product video when video icon on left panel is clicked?

I want to autoplay video when video icon on the left panel is click. Once the video icon is click the video on the container will automatically play. Here is the current classes on the video icon: ...
3
votes
1answer
8k views

How to use RequiredJS to execute the JS after the DOM ready?

I'd like to execute my JS after the DOM ready using RequiredJS instead of this: $(window).load()
0
votes
0answers
11 views

The owl carousel is initialized before the module instagram and does not see the items

I have a block that displays pictures from instagram, he gets them using the library. https://www.mageplaza.com/magento-2-instagram-feed I have 6 elements in a row, I want to use them in a carousel ...
0
votes
0answers
11 views

Magento 2.3.2 No Conversion tracking data

I have been having issues with Magento 2.3.2 conversion tracking in Google analytics. I have tried many different free extensions but still not having any luck. We are using magento native checkout ...
0
votes
1answer
43 views

Magento 2 with Gatsby and GraphQl issue

I am trying to integrate the magento2.3.2 with gatsby js and Graphql. For reference please check this link https://www.gatsbyjs.org/packages/gatsby-source-magento2/ I have integrated everything but I ...
0
votes
0answers
10 views

Uncaught ReferenceError: ConfigurableMediaImages is not defined error Magento 1.9.4.2

I have been looking to incorporate infinite scrolling into my site. So, when I came across the InfiniteScroll Magento Plugin by Strategery-Inc I was excited to give it a go. However, I get the error: ...
3
votes
2answers
24 views

Javascript customer data, options is undefined in Firefox

I have tis issue with the customer-data Javascript object. Her is (a par of my code) define([ 'jquery', "Magento_Customer/js/customer-data" ], function ($, customerData) { 'use strict'; ...
0
votes
1answer
26 views

Magento 2 with gatsby grapgql for product view page?

I am using gatsby js and successfully got the product list in index.js But I need to show the detail of product on click. So I used the below code in gatsby-node.js file. const path = require('path')...
0
votes
2answers
1k views

Confirm Password Validation Not Working

I have an issue with the confirmation password validation on creating the account and reset password pages and showing the following error although the passwords match? Please enter the same value ...
1
vote
3answers
1k views

My javascript doesn't run in a custom magento1.9 module

I try to use javascript for a dropdown list I've implemented into a grid as shown in the image. The renderer I use for this dropdown list is like <?php class ...
0
votes
1answer
25 views

Magento 1 - Jquery datepicker error with merged JS

In magento 1 when merged javascript files is set to "yes" I encountered this error : When merged javascript files is set to "No" there was no problem with jquery datepicker. Do you have any idea ...
1
vote
1answer
652 views

Extend Swatch rendered js file

How to extend the Swatch rendered js file in my custom module? I have override the phtml template files. <script type="text/x-magento-init"> { "[data-role=swatch-option-<?= /* @...
0
votes
0answers
21 views

Not able to generate images of t shirts with different colors from single image in Magento 2

I have couple of images where the actual model**(basically person wearing that t-shirt in image)** has different poses or positioning so becomes really hard only to extract the t-shirt part and change ...
0
votes
2answers
770 views

Accessing a JS function from another JS file

I'm trying to access a function from 'create-validation-list.js'. define([ 'jquery' ], function ($) { return createValidationList = function () { // Code } shipping.js define([ 'jquery', '...
0
votes
1answer
1k views

Lots of jQuery conflicts on Magento 2

I'm working on a new Magento 2 installation with the Porto theme and have noticed that when you first visit the site or have the browser cache disabled you get a lot of of jQuery conflict errors. ...
1
vote
1answer
64 views

Custom Javascript is not working in my core HTML file. Magento2

I'm trying to add some Javascript and Jquery in the core theme file which is located in magento\pub\static\frontend\magento\luma\en_US\Magento_Checkout\template\payment+methods\list.html <!-- /** ...
0
votes
1answer
1k views

Magento 2 How to add custom grid

How can I add this code in Magneto2 admin page. <html> <head> <link rel="Stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" /> <script type="text/...
0
votes
0answers
12 views

How to restrict shipping method by regoin of selected in shiiping address section?

I have created a new shipping method module. I have to enable this method by the user-selected state. If the state of the selection is Gauteng I need this method to enabled or show. I have tried it ...
2
votes
2answers
410 views

React with Magento 1.9.x

it Is it possible to integrate magento 1.9.x with lib React.JS? because I read about it but most of post says about magento 2.
9
votes
4answers
26k views

Use require-config.js to load files needed on all pages

I know how to use require-config.js in custom theme, but I would like to use custom javascript file (myfile.js) on all pages. In which directory should I add require-config.js and how to use it, so ...
0
votes
0answers
54 views

Error while using croppie.js library in magento 2

Trying to use the croppie library on product detail page and sometime it works perfectly but most of the time it throws one of these errors. TypeError: priceBoxes.priceBox is not a function ...
0
votes
3answers
589 views

Failed to load resource: the server responded with a status of 404 (Not Found). How to solve this issue?

I am running Magento 2.3 with NGINX, PHP7.1 and MariaDb. This is a fresh instalation with pre-loaded data. I am getting these follow error: $ tail var/log/system.log [2019-01-09 16:36:24] main.ERROR: ...
1
vote
1answer
27 views

Set Default Billing Address as Billing Address via knockout on checkout page

The Checkout page is currently loading Shipping address as billing and shipping address. I want to load default billing address on checkbox click and set it to order before save. I dont know how to ...
1
vote
1answer
88 views

How to change products sort order in magento 2?

In product list page I need to change the sorting order. I have a current order like: Description A-Z Price High To Low Price Low to High Description Z-A I need to change it to. Description A-Z ...
1
vote
2answers
1k views

Magento 2.1.6 - Extending the dropdownDialog (lib/web/mage/dropdown.js) not working

I am trying to extend the default dropdown.js of Magento 1) Created a new JS file at app/design/frontend/<vendor>/<theme-name>/web/js/mage/dropdown.js define([ "jquery", "jquery/...
0
votes
0answers
34 views

Magento 2: Refused to apply style from [duplicate]

Anyone can help me this problem, the issue in this link the screenshot below http://prntscr.com/p9qypy Thank you so much!
2
votes
1answer
110 views

Magento 2 : Service worker not loading in PWA

I have added the below script to my header to load service worker on load .When I load my website and check applications tab from inspect on browesr it shows nothing . <?php $ajaxUrl = $block-...