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

Provider information for the shipping address in the order summary

I created a delivery module with a pickup service. I'm stuck with the shipping address displayed in the order summary. From where does the information come from? My issue happens only when I'm a guest ...
0
votes
0answers
14 views

jQuery (server side) search and sort using Ajax

I tried to create search and sort from live URL using Ajax , i used do search function and i managed to retrieve the data from the URL . I am showing Ajax response in select options as below code. I ...
0
votes
0answers
9 views

SET THE RIGHT DOMAIN NAME IN MAGENTO 2 COOKIES

I set cookies (in Magento 2.3.1 EE) with this code below: <script type="text/javascript"> require([ 'jquery', 'jquery/jquery.cookie' ], function ($) { $(document).ready(...
0
votes
1answer
13 views

Change position of elements/uiComponents in Magento 2 checkout depending on screen size

I have 2 html elements on my checkout for which I need to change the position on the page, depending on whether it's being displayed on mobile device or desktop. I cannot solve this using css only ...
0
votes
1answer
26 views

Global Payments Realex 511 Redirect Issue Magento 2.2.2 HPP

I am using this module for Global Payments / Realex Payments for Magento 2.2.2 store form Magento Marketplace "name" : "realexpayments/hpp", "description" : "A ...
0
votes
1answer
18 views

Script injection below body tag in Magento 2.4.1

I upgraded our Magento from 1.9 to 2.4.1 after we found malware that was trying copy customer credit cards before allowing the customer to use PayPal. I used Magento's migration tools to copy data to ...
0
votes
0answers
26 views

Magento 2.4 - Express Checkout - Shipping Address Error

A fresh install Magento 2.4.x + theme, but having some issue related to express checkout, as seen from below picture on red-box area. The form has missing some elements, like firstname, lastname etc. ...
0
votes
1answer
16 views

Magento 2.4 admin keep on infinite loading

I updated my magento from 2.1 to 2.4 . My admin panel keeps on loading since long. Below is error i see in console. Failed to load resource: the server responded with a status of 404 (Not Found) ...
0
votes
0answers
9 views

How to add a script to all product descriptions

How to create a js widget that will add the current date on the product page to the description on the <p id="lol"></p> element? Or which will insert a p tag with a date at the ...
0
votes
3answers
30 views

Magento 2 How to combine custom module JS in one JS file?

I have multiple modules installed on my website, all modules have scripts in phtml file. I need to move that all scripts into one JS file so it can reduce the page size and merged them as a JS file. I ...
0
votes
0answers
13 views

How to pass parameter from phtml template file to controller in Magento 2

I have created a custom module. It basically displays a popup modal that prompts user to enter their ship-to location. Below is my code: Learning\etc\module.xml <?xml version="1.0"?> &...
0
votes
0answers
8 views

how can I apply and clear a layered navigation filter via javascript in Magento 2.4?

I would like to create some quick filter buttons for layered navigation, for example to trigger popular filters like featured products, recommended etc. I would like to programmatically trigger the ...
2
votes
1answer
22 views

HTML files not being overwritten in app/Design

I'm trying to override html files the same way that I would override a phtml file, but it doesn't seem to be working. Same with Javascript. I'm trying to change some logic in minicart.js. I put my ...
1
vote
0answers
26 views

How to hide aria-required = “true” field by js in checkout magento 2

I add these fields using custom modules, so that when "Persoana Fizica" is clicked, these fields are hidden and will not affect the magento's data transmission. And when I click on "...
0
votes
1answer
22 views

How to add external JS script to product page in Magento 1.9?

I'm trying to add a JS Script for some specific products in the product detail page but I dont know how to. I know I can edit the xml file and add scripts there... but the source of the script ...
0
votes
0answers
21 views

How do i translate Javascript text?

I've been trying to translate the word "Open Now" that is written in my JavaScript like so $('.store__info_' + locationCode).text('Open Now'); I followed the dev docs here, to no avail. I'...
1
vote
1answer
50 views

Magento2 - including THREE.js in custom module

I'm using a 3D model object in my Magento (2.4.0) site for which I need to use three.js lib along with GLTFLoader and OrbitControls. GLTFLoader and OrbitControls are THREE.js dependents. I kept the ...
0
votes
0answers
28 views

How to check all elements of first array with single element of second array one by one using jquery

Like I have two arrays and I wan't to disable value from drop down which are greater then single element of array. ['5', '10', '15', '20', '25', '30'] // dropdown ['10', '15', '20'] // second array ...
2
votes
2answers
99 views

Uncaught TypeError: Cannot read property 'remove' of undefined — upgrade from 2.3.4 to 2.4.1

Uncaught TypeError: Cannot read property 'remove' of undefined -- upgrade from 2.3.4 to 2.4.1 I'm testing out an upgrade of our Magento store from 2.3.4 to 2.4.1. One issue I have come across is this ...
0
votes
2answers
33 views

UK GB Post Code Zip Validation Magento 2 Space

I need some help with UK GB Post Code Zip Validation Magento 2 Space In that I want to force the user to enter spaces so its like this EC1A 1BB or W1A 0AX or M1 1AE so there must be space After the ...
1
vote
1answer
45 views

how to add jquery on magento 2

I am using Magento 2, in my case I want to add an element after another using jQuery, can anyway tell me how to it, the best practice please For example i want to insert a div with class 'one' after ...
0
votes
0answers
9 views

Adding (complex) 3rd Party JS to Module

I'd like to add a large/complex JS file to my module. It's this: https://github.com/google/open-location-code From what I can tell, it's not being added at all. /app/code/Abc/Pp/view/frontend/...
0
votes
0answers
68 views

Magento 2: Remove unused JS from home page

There are several unused JS files which we do not use on the homepage. JS files are: jquery/ui-modules/datepicker.js jquery/ui-modules/timepicker.js moment.js jquery/ui-modules/sortable.js jquery/...
0
votes
0answers
6 views

Create a Multidimension array and convert this in JSON format

I want to create JSON data to pass in AJAX. I'll pass the dynamic value of country & postcode in the below JSON. Let me know how to perform this task. Required data to pass in JSON {"address&...
0
votes
2answers
32 views

Require JS script implementation issue

I am trying to implement the SurveyJS library into my page but it doesn't seem to work at all and I keep getting "Survey is undefined" whenever I call the Survey object methods, as detailed ...
0
votes
1answer
17 views

Css and js not working after transfered site to new server Magento2

I have moved my magento to new dedicated server ,css and js not working. Also have done static deploy,Can anyone help me to fix this issue
0
votes
0answers
24 views

Magento 2.3.3 Layout Update XML

I'm doing some performance tuning on the Magento 2 system I manage, and as an example I've created a minified (and custom) version of share.js used in the "addtoany" social media plugin. The ...
0
votes
0answers
11 views

How can I prevent collapsible to be collapsed?

I'd like to prevent main categories filter to be collapsed thus I'd like it "always fixed". How can I achieve it? I tried something like: $('.filter-options-item').collapsible({ collapsible: ...
0
votes
3answers
88 views

Add JS on condition

I'm want to add a dynamic js remote file in my website. So far, I've added CSS file thanks to this, but I can't achieve to add CSS files. I've an observer with that. <event name="...
0
votes
0answers
5 views

Load icon spinning at new loaded product's detail page

I have an outstock furniture theme, so i customize it and turn it a techno store.But when i add a new product, i can not access its detail page, page waiting as loaded but load icon doesn't stop ...
0
votes
1answer
9 views

Magento 2: Not able to delete second layout in widget

Magento 2.4 Admin > Content > widget After creating a new widget I have added two layouts. When I had tried to delete the second layout then the delete button is not worked. https://drive....
0
votes
1answer
38 views

Change js file in production mode

I changed this file app/design/frontend/VENDOR/THEME/web/mage/validation.js But changes are not reflected; I'm in production mode I deployed static content with bin/magento setup:static-content:...
0
votes
0answers
24 views

Three is not defined in Magento 2

new THREE.WEBGLRENDER Three is not defined when i'm using it in Magento 2 with requirejs . THREERENDERER = new THREE.WebGLRenderer({ context: spec.GL, canvas: spec.canvasElement });</quo you can ...
2
votes
2answers
63 views

How to add JS code in the head tag for only in the success page in Magento 2?

I need to add a JS script on the head tag, but only in the Success page. Inside Magento 2, I have no idea how doing this. Someone can help me? :)
0
votes
0answers
19 views

Force all Caps/Uppercase on Magento2 Registration Form

I am looking for the proper way to force the Magento 2.3 registration form to submit all registrations in all caps. I have tried the text-transform:uppercase with no luck. I am thinking that Magento ...
0
votes
0answers
18 views

Magento 2 - Custom widget chooser field select custom content type

I am wondering if this is possible. I'm trying to build a custom Widget with a Chooser field on the Admin that would select a custom Content type named "Event" item. By default, Chooser is ...
0
votes
0answers
17 views

How to execute javascript function after a product is added to cart?

I'm trying to configure Sendinblue Automation to work with Magento 2. In order to do that, I have to execute some Javascript functions after some Magento events like: After a product is added to cart....
0
votes
0answers
19 views

How to add text to URL so pages reflect only in stock options when in Magento 2

Currently, on my site when I access product pages, the product counts reflect both in and out of stock options. I would like when those product pages are loaded, the url changes to add '?stock=1' to ...
0
votes
1answer
48 views

Magento 2- How remove js files

I am trying to remove some js files from Magento 2 upload in the frontend. This is my code but it doesn't work because when reload category page and i open sources->coverage of chrome i see ever ...
0
votes
0answers
35 views

How to execute javascript code and pass to it some values after an event is triggered?

I'm trying to execute some javascript code and pass to it some values after an event (e.g. Add to Cart event) is triggered. To be more specific I'd like to pass: All logged customer details (...
1
vote
0answers
18 views

How can I get my custom modal to work in with my js

This is a fiddle I have with it working but I would not like to apply it within magento http://jsfiddle.net/7yhmkf98/ I have a requirejs-comfig.js file set uo like this var config = { paths: { ...
0
votes
0answers
16 views

Add to cart button on a js file

Add to cart button in selected products in my code function () { var self = this; $('body').delegate('#product_grid_table tbody tr', 'click', function () { var ...
0
votes
1answer
378 views

Cannot read property 'push' of undefined

When pushing an array's contents i get here is my code
0
votes
0answers
56 views

How to display cart item count in custom header using JavaScript?

I've created a custom header that works fine. I replaced Magento's cart, and instead added a shopping basket icon in the header. Like so: When pressed it redirects to the cart. What I want to do is ...
0
votes
0answers
16 views

How to integrate Sendinblue Automation with Magento 2?

I'm trying to integrate Sendinblue Automation with Magento 2.4.1. In order to do that, I'm following the official docs that basically says this: Install the Javascript tracker by placing the ...
0
votes
1answer
42 views

How to use fotorama in my custom widget?

I want to display my product image gallery in my custom widget. $images = $_item->getMediaGalleryImages(); is how I got my images for product. I want to display the image using fotorama? is this ...
0
votes
1answer
20 views

Magento Snippet code in CMS not working with double curly braces {{}}

My 3rd party plugin company ask me to Snippet in this code to my CMS page. but Magento did translate something else for the double curly braces. How can I Snippet in below code to the CMS page? <...
0
votes
1answer
16 views

jQuery function call on focus out for form field not working

I have created a Magento admin form with following fields. $skuField = $fieldset->addField( 'sku', 'text', [ 'name' => 'sku', 'label' => __(...
0
votes
1answer
33 views

Magento 2.3.4 JS Uncaught ReferenceError with custom payment method

I could need some help. I've added a custom payment method to our shop following this tutorial: https://webkul.com/blog/create-custom-payment-method-magento2/ So far so good, but after loading the ...
2
votes
3answers
59 views

How can overwrite an event from JS file in custom theme or module without overwriting the whole file?

How can overwrite an event from sidebar.js in my custom theme or custom module without effecting anything else that is located in the file? What is the best approach? I need to make the following ...

1
2 3 4 5
43