People who code: we want your input. Take the 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
0answers
4 views

Is it possible to load jquery and other js files into magento 2 footer?

Guys I would like to know if it is possible to load js files in magento 2 footer. For example using the tag . And how would I do that?
3
votes
1answer
2k views

Magento 1.9.1 swatches don't swap images

I've modified my custom template to be able to use swatches with it. (Applied this solution How to use Magento 1.9.1.0 Configurable Swatches in Default package theme (or a custom theme)?) Everything ...
0
votes
0answers
12 views

How to call javascript function in magento 2

<div class="block social-login-authentication-channel account-social-login"> <div class="block-content"> <div class="actions-...
0
votes
1answer
1k 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
0answers
11 views

M2: How to validate checkout if certain region is selected?

I need to know how to validate if certain region is selected and prevent placing orders. The thing is that the carrier told us that certain regions are out of their services so if the customer select ...
4
votes
1answer
5k views

Modify checkout step navigation magento 2

I'm customizing the checkout process in magento 2 by adding a custom step between Shipping and Payment steps and by adding a checkbox in Shipping step. The problem When going to checkout page for ...
0
votes
0answers
15 views

Php information on custom module for checkout page

I have created a working custom module that shows a message on checkout page following this solution https://stackoverflow.com/questions/56974955/need-to-write-a-custom-message-on-checkout-page-in-...
1
vote
2answers
43 views

How to add custom script on the header in magento2?

I want to include the js file on the header of the page. But I have selected the 'Move JS code to the bottom of the page' configuration from the admin panel. I want to include one specific script load ...
0
votes
1answer
18 views

Magento 2 how to use phtml jquery events on knockouts js component template?

I'm struggling trying to approach the following objective: Use jquery events on a knockout js component template. On phtml file I have my knockout js component like this: <div class="container&...
5
votes
3answers
5k views

Uncaught TypeError: value.map is not a function coming from file-uploader.js

I am running Magento 2.2.3 When I try and go to admin/catalog/category/ and select a category it just spins and I get this javascript error. file-uploader.js:74 Uncaught TypeError: value.map is not ...
0
votes
1answer
21 views

Magento 2 Frontend Toggle Button - Show Hide Content - Options

How can I achieve on Magento 2 Frontend show a toggle button which will show/hide a custom option text area for user to fill in?
1
vote
2answers
2k 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
20 views

Magento 2 how to get session value on Javascript Knockout Js?

I'm trying to get a session variable that is created when a customer is redirected to a controller. I'm using \Magento\Framework\Session\SessionManagerInterface $coreSession So I can use it at any ...
1
vote
3answers
2k 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
2answers
210 views

How I can make Magento 2 product-info-main sticky like cart sidebar when scroll to down?

I want to make an upper bar as in https://www.atma.com.ar/molinillo-electrico-atma-mc8141n.html that contains the product info and the "add-to-cart" button, and that appears only when I ...
0
votes
3answers
4k views

Make sticky header for Magento 2 problem

I'm following the answer in this topic to keep header sticky. So far I've created vendor/theme/web/js/sticky.js with the following content: require([ "jquery" ], function($) { $(window).scroll(...
2
votes
3answers
92 views

Magento 2 - Override Mixin with another Mixin

The module Amasty_HidePrice overrides mage/validation by using a mixin. But this mixin has a bug and I need to fix it by overriding the mixin with my own mixin. This is the original mixin (shortened ...
1
vote
2answers
1k views

How to Validate Special Characters in Magento 2 Validation Mixin

I want to validate special characters in a custom validation mixin file (validation-mixin.js) When I am using this validation mixin for my input field, i.e. a Purchase Order Number in checkout, it ...
0
votes
0answers
19 views

Magento 2 Uncaught ReferenceError: jsSHA is not defined

I am getting this error message when I try to use JQuery 1.11.3: Uncaught ReferenceError: jsSHA is not defined. I actually try to download the JQuery js file to call it locally but I gets the same ...
0
votes
2answers
2k 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
2answers
2k views

Adding custom js and css to Product grid in Magento 2

Can we add custom JavaScript and CSS to the Product grid. I've created a product_listing.xml within my own module, and it's working, but can we add custom JS and CSS to product_listing.xml like we do ...
11
votes
6answers
39k views

How to call Owl Slider in Magento2

If we want to add Owl Slider in Magento 1.X then we follow the below steps. Copy owl.carousel.min.js and owl.carousel.js and paste into skin/frontend/pakage_name/theme_name/js Copy owl.carousel.css ...
0
votes
1answer
27 views

How can I build the URL from JS file with key - url.builder not working -

I have added a Ajax function to get data, but I need to add secure key to my link. define([ 'jquery', 'underscore', 'uiRegistry', 'Magento_Ui/js/form/element/select', 'Magento_Ui/...
0
votes
2answers
4k views

Uncaught DOMException: Blocked a Frame with origin from accessing a cross origin-frame

I have a Magento 1.9 site that uses TinyMCE. Everything worked fine until I added a cdn. The script wouldn't load because it was on a different domain. I went ahead and added a subdomain but it still ...
0
votes
1answer
2k views

Trigger modal after placing a product in minicart on Magento 2

I need to show a modal after a product is placed inside cart. This is what i have so far. This is my default.xml <body> <referenceContainer name="content"> <block ...
0
votes
1answer
2k 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. ...
3
votes
8answers
2k views

jQuery not working for custom checkbox on checkout page

I am looking to create a custom checkbox field on the checkout process that a customer can click to define if they are a business customer or a consumer. To do so I made a module with the file ...
0
votes
0answers
20 views

how to return external js function?

I am integrating custom payment. The payment provider gives a script from their side. need to call a function from their script with the generated token. By calling that function, it will redirect to ...
0
votes
1answer
931 views

Magento : Get Configurable Product Price From Simple Products

Is it possible to get simple product price without manually updating associated fixed price or percentage? We have more than 3000 configurable products, so it's not possible to do it manually. Can ...
0
votes
0answers
8 views

Prevent scroll to top after adding to compare , remains on same position

On my category page there is a compare button , when clicked the page refresh and scroll to top, I need to stay on the same position , any idea? thanks
0
votes
1answer
992 views

How to pass a value to modal while opening

Is it possible to pass a value while opening a modal(js component of magento)? If the answer is yes, then how can i do it?
0
votes
0answers
20 views

Javascript show array of value depending on if statment

I need to show an array of values based on current date, for example show only 10am to 13am if we are on current date, if not show all...this is what i have done so far but i cant get it working again ...
3
votes
2answers
2k views

Magento 2: How To Disable Button On Form Submit?

I'm trying to disable button after submitting form, but i'm facing some issue, when i submit black field it validate the form and disable the button... but i want to disable it on form submit ...
0
votes
1answer
5 views

Magento 2: I Want To Make Custom Products Tab On Home Page

I trying to make custom dynamic tab on home page but when do that I get an error Uncaught ReferenceError: tab is not defined at HTMLButtonElement.onclick ((index):1200) Here is my code I don't know ...
0
votes
1answer
13 views

Magento 2 callback dimensionsChanged accordion does not work

I built an accordion from the Magento 2 documentation. CODE JS: $(".init-accordion").accordion({ "active": [1, 2], "collapsible": true, "openedState"...
0
votes
1answer
16 views

Magento 2 - Fix “Please enter a value greater than or equal to NaN.” for input type date

I need to add a date input field to my contact site, so that users can select a date when we can call them back. I filled the attribute min with the date of today, to prohibit the user from selecting ...
0
votes
1answer
17 views

Add custom javascript after js components load

I'm still a novice when it comes to Magento 2 frontend with jsLayout, requireJS, etc. I have a custom module where, in javascript, I am trying to attach an onchange listener to the email textbox. I ...
1
vote
1answer
1k views

styles and js not found 404 magento2

I installed magento2 on openserver created my custom theme developer mode is enabled content deployed When i try to load home page browser showed errors in pub/static i have only wNumb.min.js and ...
0
votes
1answer
1k views

mage/translation not working magento 2 (translation issue)

I am working on pdp page (mobile view), in drop down i need to show out of stock if qty is out of stock and low stock if qty is low stock, it is working as expected but it is not getting translated to ...
3
votes
1answer
2k views

How to track product list impressions/clicks and related sales?

We have products in several different categories in our Magento shop. And with enhanced ecommerce tracking we want track the product list performance. I used this Google dev docs. Eg.: Product is in ...
1
vote
6answers
4k views

magento 2 Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option'

I am having an issue on my website the issue Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option' My website https://www.cartaroo.com.cy/?...
0
votes
0answers
20 views

JS error “Cannot read property 'timestamp'” at checkout after upgrade from 2.3.3 to 2.4.2-p1

I upgraded Magento 2.3.3 to 2.4.2-p1 and at the checkout it presents this error and just keeps loading the checkout. Uncaught TypeError: Cannot read property 'timestamp' of undefined at UiClass....
0
votes
1answer
25 views

How to override js files in Child theme? Magento 2.4

I've been overriding a few files in our child theme which seems to work perfectly, however, I don't seem to be able to override JS files. In this case, I'm trying to increase the yearRange in the ...
0
votes
1answer
29 views

How to pass current value of Ui form field in js file

I want to pass the value of checkbox in custom js file, I am using UI component to create a chechbox. So I have to pass this value to js file and then use that value in Model. I am not able to pass ...
0
votes
1answer
87 views

Magento 2.4.2 - Strange problem with JS path in a multistore environment

I have a really strange problem. We load a JS file in before.body.end in a multistore setup, like this: \app\design\frontend\Vendor\Theme\Magento_Theme\layout\default.xml <referenceContainer ...
5
votes
2answers
13k views

Open category filters by default in Magento 2

Is it possible to open category filters in the left pane by default in Magento 2 Luma theme.
0
votes
0answers
15 views

How to modify datepicker input template and js file?

I want to change date input data bind attributes and I don't know exactly which file I should overwrite. I changed these files but output is still the same. map: { '*': { 'Magento_Ui/...
1
vote
3answers
1k views

Show div after delay on Magento 2 with JQuery

I need to show this div after 3 seconds on my page. <div id="cratepop"> <br> <center><img src="/shoppingcart.png"></center> <br> </div> ...
0
votes
0answers
19 views

Magento 2: Adding a Javascript library

I am trying to add an animation library called Sal, built on pure Javascript (Does not rely on jQuery). Maybe I am missing something, but I followed the instructions on adding via require-config, and ...
0
votes
0answers
13 views

Structure of a vue application in a magento theme context (NOT STOREFRONT)

Unfortunately google really wants to tell me about Vue storefront whenever I search for it with magento but I only want to integrate vue as part of a regular frontend theme.. Primarily to work on a ...

1
2 3 4 5
44