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
20 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 ...
0
votes
1answer
27 views

How is js loaded and removed in Magento 2?

Inevitably, I'm trying to improve our Magento 2.3.0 Pagespeed score. Most of the damage is being done by the excess of unneeded/unwanted js files. Is there any simple way to remove js such as calendar....
0
votes
1answer
23 views

Auto close modal widget after 5 seconds

I created a modal widget that appears after adding product to cart, it works perfectly .Now I need to close the modal after 5 seconds.please help!
0
votes
1answer
13 views

$fotorama not loading consistantly

I know this has been asked before, but I haven't been able to find a solution. I'm using the latest version of Magento 2 with the Porto theme. Occasionally things will load ok (especially in Firefox), ...
0
votes
0answers
15 views

Magento 2 how to use many components inside a component knockout js?

I wan't to import components and use them just like in Vue or ReactJs. Where you can export default component And import it by using import Name from './path/to/component'; and finally use it How ...
0
votes
1answer
33 views

Knockout JS Implementation with Phtml ReferenceError: Unable to process binding

After a lot of search in this forum I have decided to write a question by myself. I am trying to integrate my knockout page into a phtml file in way to update the input layout after a file has been ...
0
votes
2answers
25 views

Change qty script

I use a script to change the qty in the product view page and in the shopping cart page but I have a problem. when I decrease the qty instead the latest value to be 0 is -1. How I can stop the ...
0
votes
1answer
12 views

JavaScript Error (Uncaught TypeError: $.initNamespaceStorage is not a function)

We are running a Magento multi site and on ONE site only, I get this error Uncaught TypeError: $.initNamespaceStorage is not a function All sites use the same theme (just some differences between them....
0
votes
0answers
4 views

magento 2 baler build stuck

I integrated baler in Magento 2 EE. I followed below steps. - $ git clone https://github.com/magento/baler.git - $ npm install - $ npm audit fix - $ npm run build But when I run this command it is ...
0
votes
0answers
12 views

Expected to start loader but did not find one in the dom : loader.js:210 in magento 2 product page

i have see issue in my browser console : Expected to start loader but did not find one in the dom : loader.js:210 in product page. if (window.console && !ctx.parents('[data-role="loader&...
0
votes
2answers
22 views

Magento 2.4 : Frontend/Backend Not working

I am using below configuration : Magento 2.4.x PHP 7.4 Composer 2.0 Frontend and Backend is not working. All .htaccess files are there in required folder. But still,I am getting below log in apache ...
0
votes
1answer
13 views

How to initialize javascript when the user scrolls?

I need the javascript to load after the user scrolls. Right now I have a .phtml file that just has this, <div id="razoyo-gtm-user-code" style="display:none;" data-mage-init='{ &...
0
votes
0answers
5 views

Directory not being unloaded after adding it to the exclude portion of view.xml

I added this line to my view.xml file. <exclude> <item type="directory">Lib::knockoutjs</item> <item type="directory">Lib::knockoutjs/kockout</...
1
vote
0answers
7 views

How to add images in js

How to include images in js, My code : if (firstStore.address && firstStore.state && firstStore.zip && firstStore.store_hours_weekdays && firstStore....
0
votes
1answer
21 views

Input Select File should not allows to override the previous one. is it possible?

Drag and Drop file allows you to override the previous one - should this happen or should it say there's already a file in place? when select next new file.Is there any way to validate previous one ...
0
votes
0answers
16 views

Magento2 UI component focusout event not working

I am using ui component for one the form in admin and for one element i am using component js class to trigger some operations on that element, it only gives onUpdate function, is there anything we ...
0
votes
0answers
20 views

How to get dial code from selected country in textbox before telephone filed using knockout js

I want to develop functionality in that i have created one field for country dial code on checkout page and according to changes of country dropdown dial code will be changes automatically in that ...
0
votes
0answers
18 views

Is there a way to delay the Javascript that gets compiled by require-config.js from being loaded in the browser?

For example in requirejs-config.js I have this var config = { map: { "*": { msapp : "Magento_Theme/js/msapp" } } }; Then I notice that it ...
0
votes
2answers
72 views

Magento 2 - Create simple hello world script with uiComponent

I try to create my own Component and reuse it. So I created these files: THEME = app\design\frontend\company\fresh Component File: THEME\web\js\elements\custom\input_number.js define([ "...
0
votes
1answer
20 views

Magento 2 Uncaught TypeError: Constr is not a constructor when returning functions on Knockout Js

i'm trying to get functions from a JS file in a Knockou file, like this: quote.js define(['jquery', 'uiComponent', 'ko','Vendor_GetQuote/js/ajax-request'], function ($, Component, ko, ajaxrequest) { ...
1
vote
1answer
27 views

Magento 2: How to create popup alert in magento 2

I added a button in block which hits custom controller (I am not using any template) This is controller code: <?php namespace Vtn\UnexportedOrder\Controller\Adminhtml\Order; use Magento\Framework\...
0
votes
0answers
22 views

Magento 2 has default slider js?

Magento 2 provide default Slider js rather than use third party slider js ? Because I do want to increase js size of Magento 2 Store. I tried to search,but I could not find any slider js.
0
votes
1answer
46 views

Magento 2: Translate knockout html where “mailto:info@sitename.com” is used

In Magento_Checkout/web/template/minicart/content.html there is a "mailto:info@website.com" used. Now I can translate the last piece by -- ko text: $t('info@website.com') --> <-- /ko --...
1
vote
1answer
39 views

magento 2 Uncaught TypeError: Cannot read property 'data' of undefined [closed]

Magento 2.3.5 getting error on the product detail page of configurable product - Getting this error - Uncaught TypeError: Cannot read property 'data' of undefined at Object.returnCurrentImages (...
0
votes
1answer
34 views

Get order data afterPlaceOrder on checkout page

Im trying to get the order increment id after success place order is triggered. This is my method-renderer file: define( [ 'Magento_Checkout/js/view/payment/default', 'Magento_Checkout/js/...
0
votes
4answers
39 views

Magento 2 - How does require know where jquery is defined?

You can use jquery in phtml like this: require([ 'jquery' ],function($) { $(document).ready(function() { /* Your logic */ }); }); But how does the require know where to find ...
0
votes
4answers
51 views

Magento 2 - How to use jQuery3?

I try to include jQuery 3 to my project so I can use it on some CMS sites. Attempt: THEME = app\design\frontend\company\fresh\ THEME\web\js\jQuery\jquery-3.6.0.js Copy pasted the code from here to ...
0
votes
0answers
14 views

PHP third party library assets integrate in Magento

I want to integrate third party PHP raw library (Not a Magento 2 library) assets (JS, CSS and other) so that during the deployment of the static content, they are made available. I tried the approach ...
1
vote
2answers
34 views

Recover customer data on product page

I am trying to recover customer data on product page as I cannot pass by php because of full page cache I want to do it in js. I added an phtml block on my page in footer, catalog_product_view.xml <...
0
votes
2answers
63 views

Magento 2 grid issue when clicking a row: Uncaught TypeError: Cannot read property 'index' of undefined

i have a grid in which i display data from a DataProvider. The issue is when i click on a row, it returns the following javascript issue: actions.js:216 Uncaught TypeError: Cannot read property 'index'...
0
votes
2answers
50 views

how to hide the filter in product listing page without modify the code base?

How to hide the filer in product listing page without touching the code? Can I do it by CSS or javascript? Thank you
0
votes
1answer
24 views

How do I get a visitor time zone in magento 2 in contact us form

I have a contact us form, I want to set echo the time zone in my "abc.phtml" file on the basis of the visitor visits the page into the contact us form, it should display there and in my ...
0
votes
0answers
17 views

How to manipulate data from Dynamic Rows component via JavaScript?

I have an Admin form (ui_component) that gets data dynamically from Ajax. The data provided to the form is dynamically loaded based on the values of other inputs in the form. There is a DataProvider (...
0
votes
0answers
25 views

Compiled JS appearing in checkout

after upgrading our platform in Magento 2.4.2 we're facing an issue where the compiled js from root/vendor/magento/magento2-base/lib/web/legacy-build.min.js is appearing in the frontend of the website....
0
votes
1answer
26 views

Magento 2.4.2: SyntaxError: Unexpected token: name (url)

I'm following the instructions to get advanced JS bundling done. I have been doing this over a year without much difficulty. This time around, I find the error below and I would like to know if there ...
0
votes
2answers
21 views

JS file is not working

JS for my main page is working..for example, I am using main_file.js for my default loaded page. Which is actually working properly. but I have a search option on my default page which leads to some ...
0
votes
1answer
28 views

I found this script in HTML Head > scripts and style sheets. Is this malware script?

i found this script in my magento 2. Is this malware script <script>(function(){function N(p,r){function q(a){if(q[a]!==w)return q[a];var c;if("bug-string-char-index"==a)c="a"...
0
votes
0answers
36 views

Javascript mixin issues - base is not a constructor

I ran into an interesting issue while trying to create a mixin for a 3rd party JS script. I created the mixin in the normal way with my requirejs-config.js like this: let config = { config: { ...
0
votes
2answers
65 views

Magento 2.4 get value of Dynamic Rows for Ajax [closed]

I've got a form that uses ajax to submit data. I recently added a dynamicRows component to the form and using ajax doesn't appear to be as straight forward. What I was using (on Non DynamicRows input) ...
2
votes
1answer
38 views

Add custom popup using Modal

Want to open a popup by clicking the button in homepage. inside the popup form will be submitted using Ajax call
1
vote
1answer
35 views

Magento: addEventListener on change radio button not working using requirejs

Here everything works fine just one issue is there, it doesn't the value and id of input radio fields, So I think domReady addEventListener is not working here. Help is really appreciated TIA This is ...
1
vote
0answers
23 views

Magento 2 Content Security Policy: The page’s settings observed the loading of a resource at https://xuz/font-awesome.min.css (“style-src”) [duplicate]

We transfer hosting to another hosting company everything is working fine but we are getting console errors in firefox like this - "The page’s settings observed the loading of a resource at https:...
0
votes
1answer
17 views

JavaScript Session and Magento 2

Does Magento 2 allow JavaScript session storage? Description: Actually, I want to store data inside the session of JS and utilize it in other phtml files which are actually replacing the previous one....
0
votes
1answer
39 views

Should jQuery be injected

Is jQuery injection needed in following example ? define(['jquery', 'componentX'], function(jQuery){ jQuery('#test').html('') }) What is worth to mention, componentX looks more or less like this:...
0
votes
0answers
39 views

datetimepicker is not a function?

After installing the module https://github.com/ecomteck/module-delivery-date on magento2, the input field is displayed without date selection. The console shows an error: knockout.js: 3381 Uncaught ...
0
votes
1answer
29 views

Why do I see the wrong static files path in my JS?

After installing and deploying the static files, Magento is looking for: http://127.0.0.1/magento2/static/adminhtml/Magento/backend/en_US/requirejs/require.js instead of: http://127.0.0.1/magento2/pub/...
1
vote
2answers
44 views

How to add an input field with a date to the checkout page?

I'm studying Magento2, downloaded the module https://github.com/ecomteck/module-delivery-date and added it to the app / code / vendor / module-delivery-date folder I cannot understand in which files ...
0
votes
1answer
31 views

override javascript from module

I want to override file from module. vendor/mageworx/module-storelocator/view/frontend/web/js/locations-modal.js I create file app/design/frontend/Mgs/claue_child/MageWorx_StoreLocator/web/js/...
0
votes
0answers
24 views

pagination using jquery

I have a search bar on my page when I search for something it returns the result perfectly with correct pagination. As shown below but when I clicked on page 2, it returns the data correctly but ...
0
votes
0answers
27 views

magento2: View model knockout

I am new in magento module development. I was searching for something similar to this https://www.mageplaza.com/devdocs/how-add-custom-discount-magento-2.html I just editied the code in step 2 to meet ...

1
2 3 4 5
44