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
1 answer
13 views

Ui component validation remove using js magento2

I have a fieldset in my UI component. Depending on certain conditions, I show/hide fields within it. All fields are initially marked as required in the UI component. However, I want to remove the '...
Chippy Ani's user avatar
0 votes
0 answers
6 views

MFTF with protected files

I am doing an MFTF for the product page on a test environment with htpasswd (apache file protection), I enter the htpasswd credentials in the url in order to bypass the test. ex: https://test:test@dev....
Mohammed Alrefai's user avatar
0 votes
0 answers
21 views

Magento 2 admin page menu and buttons didnt work after speed optimization

After we enable javascript bundling and minify javascript files, admin left menu and buttons didnt work. Also in our website we could add products to the basket. Thank you for your help.
Mabita's user avatar
  • 1
0 votes
0 answers
8 views

In magento, how can we bring the swatch options of a configurable product and it's corresponding image url's in an array?

I need to bring the swatch options of a configurable product and its corresponding image url's stored in an array in PLP page in magento. How can I do that? I got an empty image url array while trying....
Farseen's user avatar
0 votes
1 answer
38 views

Magento2 | Reduce JS files to optimize site performance

I am trying to figure out how I can exclude some js files that Magento2 loads and makes it so heavy however without compromising the functionality of the site. On my site with Magento2 I have a lot of ...
Jackom's user avatar
  • 473
0 votes
0 answers
11 views

XML formatting problem: Aligning 'Options' at the same level as 'Lines' instead of nested within

I am working on a Node script that creates an XML file using data it has pulled from the Magento api. This xml file has a set structure that I have to replicate. I've been having issues getting it set ...
atomic-ag's user avatar
0 votes
0 answers
20 views

Magento2 how to load payment page withot loading the page.?

Magento2 how to load the payment page without loading the page.? I want to refresh my payment page without loading into the js file. can anyone give a solution for this? Here is my js file with some ...
Ekta's user avatar
  • 101
1 vote
2 answers
49 views

Hide DIV if another DIV is active or visible with css/js

Trying to hide DIV if another DIV is active or visible with css/js. Basically if an item is out of stock I would like to hide my custom div. <script type="text/javascript"> require(['...
Shaun's user avatar
  • 99
0 votes
1 answer
40 views

how to remove js files from layout added to page through require or direct src

i want to remove js files from a layout checkout_index_index which is loading by require or direct src. 1) <script src="https://abc.abc.ai/prompt.js" src_type="url" /> ...
nihal malik's user avatar
1 vote
3 answers
360 views

Magento 2 Google language translate script not working

The script was functional on our Magento 2 website until last week. However, for the past four days, we've been encountering JavaScript and Knockout.js errors in the console when this script is active....
Keval Chauhan's user avatar
1 vote
1 answer
22 views

How to retain line breaks when reading text from within <td></td>

With the jQuery below, I'm able to copy the content into clipboard but not to retain the line breaks. HTML: <td width="700" id="message_id2"> We are sorry you are ...
CodeForGood's user avatar
0 votes
0 answers
26 views

how to fix magento runs in the wrong js path

I'm having a problem: my js line is correct but when running, Magento runs incorrectly. Does anyone know how to fix it?
hau's user avatar
  • 41
0 votes
1 answer
47 views

Unable to resolve the source file for

When I run it, the system log shows the message Unable to resolve the source file for, but when I check the path of the js files, Magento runs at the wrong path. Does anyone know how to fix this error?...
hau's user avatar
  • 41
0 votes
0 answers
23 views

Magento 2: How to separate this plugin into 2 different fields

I have import this plugin in my project https://github.com/MaxMage/international-telephone-input. Now I split into 1 field dial_code, 1 field phone but when i choose dial_code and click outside. The ...
Simon's user avatar
  • 1
0 votes
1 answer
33 views

Create an extension using Javascript

I am new to Magento development and finding the process a little overwhelming. I am a Javascript developer without any PHP experience. To help me get started I decided to Vue Storefront's SDKs (using ...
Charklewis's user avatar
0 votes
1 answer
54 views

Why is a piece of code closed but still processed by Google?

When I close this code, why does it still load the code and cause an error when running?
hau's user avatar
  • 41
0 votes
1 answer
45 views

error message error when running

Why do I still get an error message when I run these js files at the correct path?
hau's user avatar
  • 41
0 votes
1 answer
58 views

How to prevent user sending requests frequently?

I believe it can be done with a PHP controller or JS cookie manipulation. Help me with logic. For example, I want a user to send a request once every 2 minutes. Let's pretend I've implemented some ...
Dramorian's user avatar
0 votes
1 answer
122 views

Magento 2 - Minify CSS and JS in pub/static folder not updating in browser

I have activated the minify and merged option for the CSS and JS files for better site performance, but recently I have had problems, after deploying and cleaning cache in both varnish and the ...
Diego Castro's user avatar
1 vote
1 answer
33 views

Add Custom JavaScript to Admin Theme

Using Magento 2.4. I want to add some custom JS in the admin area. app\code\ClientQuote\AdminTheme\view\adminhtml\requirejs-config.js var config = { map: { '*': { adminTheme: '...
xgarb's user avatar
  • 11
0 votes
2 answers
145 views

Magento 2.4.6: How to display Order IDs Based on Selected Customers in a UI Form?

I've created a UI component form that consists of two dropdown fields. The first dropdown successfully displays customer IDs and names. However, I'm encountering challenges with the second dropdown, ...
MagentoDev's user avatar
0 votes
0 answers
30 views

Add Javascript to a Single Custom Admin Configuration Page in Magento 2.4 with XML

I am developing a custom module and need to load a javascript function on my "Custom" admin configuration page created with system.xml at url "admin/system_config/edit/section/<...
Fox's user avatar
  • 191
0 votes
3 answers
193 views

After installing Magento2.4.6-p2 CSS and JS 404 not found

I installed magento2.4.6-p2 in my C:\xampp\htdocs\magento2. But I can see this. In pub .htaccess file is : ############################################ ## Optional override of deployment mode. We ...
Bohdan V.'s user avatar
0 votes
0 answers
57 views

Update selector field in Magento 2

I have a form with the following 2 fields in an xml file: Regions: <field formElement="select" name="regions" > <argument name="data" xsi:type="array&...
user113186's user avatar
0 votes
0 answers
50 views

Radio Button Will only reflect after two clicks

We are using an RMA module which let the customer select a new return for their purchased item. When clicking on the item radio to select an item it should bring up the entire information on the ...
Ran's user avatar
  • 1
1 vote
0 answers
198 views

Bad control character in string literal in JSON at position 40 Fresh installation Magento 2

I install fresh new Magento on my environment Magento version 2.4.6-p1 in the admin panel loader not gone it's take only loading. can any one guide on the same.
Jay Parmar's user avatar
1 vote
0 answers
78 views

totals.getSegment('giftcardaccount') returning null

I'm about at my whits end. I still consider myself a relative novice with Magento, but this one literally has me baffled. I've also tossed it around to some senior devs at my work, and they are ...
Drew's user avatar
  • 131
0 votes
1 answer
43 views

Show simple products URL in bundle summary

We want to make product name clickable in bundle summary. When user click on product it should be redirected to simple product page. Anyone knows if it possible?
Petacchi's user avatar
0 votes
3 answers
615 views

In magento 2 javascript , How i can wait till a component/node initialize then i can excute my code?

How to wait till components exists in registry . I want to wait till global component "messages" initialize then I can add error/success message. // view/frontend/templates/messages.phtml &...
Phạm Hòa's user avatar
0 votes
1 answer
68 views

How to load external es6 script module in Magento

Is it possible to add a script tag with the attribute type set to module e.g. type="module" in magento? I'm trying to load a es6 module through the head of the xml file but it is not ...
Alfredo Esteban Hernndez Dvalo's user avatar
1 vote
0 answers
45 views

Add Custom Field to Braintree Credit Card Payment Method in Magento 2.4

I want to add the custom field i.e. po_number in the braintree credit card method in the payment page. Here is the code which I have added for field. <?xml version="1.0"?> <page ...
Mitul Vadalia's user avatar
0 votes
1 answer
206 views

Admin not loading - JS errors

Suddenly my Magento 2.4.6 started to show a JS issue without any deployment. I had this issue below with the JavaScript loading. How could I solve it?
Rafael Corrêa Gomes's user avatar
0 votes
2 answers
120 views

How to exclude custom extension JS : Magento 2.4

I want to exclude some custom extension JS from merge functionality. so how can i achieve this functionality?
Kushal Dani's user avatar
  • 2,104
0 votes
1 answer
380 views

Magento 2 - Get cart item qty change in Javascript

I have a javascript file that loads when the page loads. This file defines two variables (one for the shopping cart items and one for the count). This script also contains a subscribe that fires ...
JamesS's user avatar
  • 101
0 votes
0 answers
30 views

Binding a custom catalog-add-to-cart.js to a custom add to cart button?

Magento 2.4.6 I added another add to cart button to the product page in addtocart.phtml: <button type="submit" title="<?php /* @escapeNotVerified */ echo $...
user4095519's user avatar
0 votes
0 answers
31 views

Why the sorting of custom product options does not work when you move the mouse?

I can't put the item elsewhere. It always stays in its place. There are no errors in the browser console. As I understand the logic of moving an object is in the file: vendor/magento/module-ui/view/...
Max Sav's user avatar
0 votes
2 answers
374 views

Magento 2 - Get location of view model of knockoutjs .html template

For example, how can I find out where the model / view model for this template is located at? vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
Black's user avatar
  • 3,280
0 votes
1 answer
56 views

Magento2 How to translate City names in the Arabic language

How to translate City names in the Arabic language. here is the screenshot. https://i.imgur.com/2UVdzrJ.png I can not translate city names on my account page.
Ekta's user avatar
  • 101
0 votes
0 answers
75 views

bootstrap.min.js:7 Uncaught Error: Bootstrap tooltips require Tether

I am using Magento 2.4.5 and I'm working on jquery. I load some minified js files including bootstrap 4 alpha 6 and tether.min.js but facing some errors in loading tether.min.js. Please help if anyone ...
varneet's user avatar
0 votes
0 answers
8 views

Custom option swatch stuck

I use custom option images to select a text font. Sometimes when I visite the productpage it is suddenly not possible to select another option. For some weird reason the custom option is stuck. ...
Bram Sluiter's user avatar
0 votes
0 answers
66 views

magento 2.4.3 detail product page on ADMIN really really slow to load

On my magento admin, the product page is really really slow (it take around 2 min for loading the detail of a product) . Apparently the javascript slow everything . I have a big volume of attribute ...
thomas poidevin's user avatar
0 votes
0 answers
37 views

How to get stock value in dropdown options on configurable probuct page?

I need to get the stock value of a simple product in the dropdown selector from the configurable product page. I found the _fillSelect method in module-configurable-product/view/frontend/web/js/...
user72861's user avatar
0 votes
0 answers
133 views

Caught TypeError: self.AnyFunction is not a function

I am trying to modify the default Magento 2 Checkout, basically I want to remove the "Payment and Review" step and put them all together. Everything goes well but I have stuck intro an issue....
George George's user avatar
0 votes
0 answers
36 views

Inserting button in mini cart which is loaded by a javascript code

I need to add button in mini cart just below the "Proceed to checkout" button. And the button is loaded using this javascript code: let sourceUrl = "{some_url/index.js}"; let ...
Pratik Giramkar's user avatar
0 votes
1 answer
109 views

Magento 2 How to get td value using script and assign that value to php variable in same phml file?

I have php variable called itemId in same phtml file and i got td value using js. now i need to assign that var id value to $itemId variable. <?php $itemId = null; ?> <table class=&...
Nihal Shantha's user avatar
0 votes
1 answer
41 views

Count Down Banner

I create a countdown banner on the homepage. I am storing from date and to date in the system.xml. I want to show the countdown between the dates From date to To date. Can anybody guide me How can I ...
Rana Zain's user avatar
  • 640
0 votes
0 answers
50 views

JavaScript not executed when it has Magento_Customer/js/customer-data dependencia in define

I have a JS file like this: define([ 'jquery', 'underscore', 'matchMedia', 'text!ajaxcart/template/modal-slide.html', 'text!ajaxcart/template/modal-popup.html', ...
Eliacim DAVILA - CENSERE's user avatar
0 votes
0 answers
111 views

Redirect to Shipping tab is not working from Payment tab in checkout step

I have an Magento 2.4.3-p1 version, when we go through the Shipping tab to Payment page, we are unable to go back to shipping tab in checkout. This is the error in the console. Uncaught TypeError: ...
Mitul Vadalia's user avatar
0 votes
0 answers
20 views

Inserting button with javascript/web component

I am a complete newbie to Magento development and I am CSE student working as an intern. My question is as follows: Is it possible to add a button to a Magento 2 page with JavaScript and web ...
Pratik Giramkar's user avatar
0 votes
1 answer
28 views

How can i pass product attribute manufacturer and SKU to javascript?

I have the following script which i need to add the product brand/manufacturer and SKU <script> window.addEventListener('liveload', function() { IcecatLive.getDatasheet( {...
just_testing_magento's user avatar

1
2 3 4 5
48