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.

668 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
159 views

JSON.parse: unexpected keyword at line 1 column 1 of the JSON data

I am getting this error in checkout. Below the Shipping Address form, Shipping Methods is stucked on loading. In console it says: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data ...
1
vote
1answer
17 views

How do I utilise Javascript merging?

To be clear, this is not a post about Javascript Bundling. This is about Javascript Merging. So, I'm in Production Mode and I'm starting to look at the optimisation of Javascript Merging. My ...
1
vote
0answers
25 views

Class not defined in validation.js after upgrade to 1.9.4.0?

I updated from 1.9.3.7 to 1.9.4.0 using the .mage command line tool. Everything works fine in the admin, the frontend however always shows me Class is not defined. The code where this happens is in ...
1
vote
0answers
32 views

Mega menu issue with product zoom

I am using Magento 2.2.6 on the product page, When you view a product, and then you go to Products Menu, once the mega menu is shown up, move mouse to the menu item over the product picture area, then ...
1
vote
0answers
43 views

How to use javascript in ko template in magento 2?

I have a custom module which will overrride vendor\magento\module-checkout\view\frontend\web\template\shipping-address\shipping-method-item.html, here is the code <!-- /** * Copyright © Magento, ...
1
vote
0answers
224 views

Magento2: custom javascript not called when using with text/x-magento-init

In list.phtml (product listing) I am showing requistition lsit for every product using type="text/x-magento-init" in loop as: <script type="text/x-magento-init"> { "*": { "...
1
vote
0answers
53 views

How to add a configurable external JS with additional data- attributes via requirejs?

I was trying to add an external JS, say https://foo.bar/script.js (the url is configurable via config data) via requirejs, and I was successful so far. But then I realized that I would need to provide ...
1
vote
2answers
922 views

how to trigger click event in M2

In my header section I have user name and if user have access to different location then he has button saying click me. I want to send ajax call on this button. But JS is not working. Can anybody help ...
1
vote
2answers
342 views

How to Load JS File at the Top?

I load my custom JavaScript file the following way: In: app/design/frontend/VENDOR/THEME/Magento_Theme/layout/default_head_blocks.xml I put: <?xml version="1.0"?> <page xmlns:xsi="http:/...
1
vote
0answers
58 views

Extend a default JS component or Use Mixin

Which is better and recommended to use Extend a default js component as explained at https://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html#extend_js or to use Mixins ...
1
vote
0answers
258 views

Magento 2 Knockout Js Customer Name update issue after changing customer name

I am having strange issue. In header, along with Welcome message i am showing Customer full name. For that i am using knockout.js concept. <?php if($block->customerLoggedIn()): ?> <li ...
1
vote
0answers
324 views

display a popup once per day!

this code is to display a pop up once per day. But I'm having trouble making it responsive, and it seems that it shows once a lifetime... Also if I put it in 3 different pages, and it only shows up ...
1
vote
1answer
555 views

Magento 2 jsonParse() does not receive data, Unexpected token '

I'm creating a js template in Magento 2. When I call js, I get an Uncaught SyntaxError: Unexpected token 'in JSON at position 96. Why jsonParse () does not get the value? Can somebody help me? file ....
1
vote
1answer
97 views

How To Debug Custom Feedback Form Sidebar Slider JavaScript Error?

I'm trying to create a Feedback form Sidebar slider. Workout: step 1: C:\wamp\www\magento\app\design\frontend\default\theme327k\layout\local.xml <?xml version="1.0" encoding="UTF-8"?> <...
1
vote
0answers
550 views

Constr is not a constructor Magento 2

I simply want to add js for my custom module but I'm getting this error: layout.js:137 Uncaught TypeError: Constr is not a constructor The hello.js file will still work, console.log will still ...
1
vote
1answer
75 views

Magento 1.9 How to add js to order review tab?

I want to hide an the tax row, but I dont know when is generated so I can add some js to hide it.
1
vote
2answers
42 views

JavaScript and CSS don´t works in my Magento 2 page

I found a "partial" solution on the Internet, but if I use that "solution", my store don´t works: If I use that, this is the result: Home JS page Store Like you can see, if it makes me choose ...
1
vote
0answers
56 views

How to solve Js load error? Shipping Extension

I am using Sendle shipping extension, this extension work as, if you give zip code gives auto suggestion of city, after I migrate server, the auto suggestion not working. The extension developer ...
1
vote
0answers
50 views

Issues creating a widget with repeated functionality in Javascript

Have a controller class setup as a widget. Labeled here as "buttonController". I'm trying to call and instantiate an instance of the controller widget per each button. Everything seemingly works, ...
1
vote
0answers
127 views

Magento 2 – default admin editor -where is settings js code?

I want to change admin editor setting but not found config js code, please guys share me JS code path so i can change editor settings.
1
vote
1answer
515 views

Magento2 - Wait for checkout page completely loaded and fire JS code

The goal is to add a piece of JS to manipulate a datepicker on the checkout page. I use a OSC (OneStepCheckout from mageplaza). So far I've followed this documentation and added this mixin: var ...
1
vote
0answers
27 views

Magento 2 : How to Use Custom AJAX Code in Admin Front End

I'm developing a delivery system for handling parcels that are handled the delivery agents. since I'm a open cart developer and new to magento, its hard for me to develop. Kindly tell me how to add ...
1
vote
0answers
96 views

Building javascript “Order by for same day shipping” countdown timer

I've got an online store in Magento and I want to add a countdown timer so that if a customer orders by 5pm Eastern Standard time their product will ship the same day. I need it to be freely usable in ...
1
vote
0answers
62 views

Error in css and js in child theme in Magento 1

I'm having a problem loading style sheets and scripts. I created a child theme, and I did not add any css or js to it. Even so, the magento looks for them in the son theme instead of the father. I'll ...
1
vote
0answers
28 views

how to rewrite magento2 backend menu js

I want to rewrite magento2 js The file path is "vendor/magento/theme-adminhtml-backend/web/js/theme.js", what should i do? Thanks for you helping
1
vote
0answers
30 views

Is it advisable to put JS in the footer? Magento 1.9.x

A query is a good practice to put the JS in the footer in magento 1.9.x? In Google Speed ​​Test tells me that there are resources that clog the page when loading
1
vote
1answer
134 views

JavaScript Merge issue in Magento 1.9

I have one issue, I enabled JavaScript merge option in magento backed but iam getting many issues in checkout page. Please see the image. anyone please help. I need javascript merge because i saw ...
1
vote
1answer
241 views

Magento 2: Browser console error on hard refresh

I am facing some weird issue with Magento 2.2.5 version. When I first-time open website, I am getting lots of js errors. (Screenshot attached) After this, when I only press F5 button (normal refresh) ...
1
vote
0answers
27 views

Magento 2: Translation in JavaScript don't work

I try to translate the next line and this don't show changes: if (pending > 0) { $('#wrapper-freeshipping_alert > p').text($.mage.__('You need %1 more for free shipping').replace('%1', ...
1
vote
1answer
365 views

customer undefined trying to check if logged in

I'm trying to display a registration pop-up only if a user has never seen it before and it occurred to me it would be wise to also check to make sure they were not already logged in. But when I ...
1
vote
1answer
187 views

Magento 2.2.2 Javascript bundle file size only 1Mb

I enabled bundle javascript file, but i saw in my local js file is 3.7Mb and my dev site just 1.0Mb. Here is my config 'dev' => array ( 'js' => array ( 'merge_files' => '1',...
1
vote
0answers
413 views

Magento 2.2.4 Implementing Bootstrap 4 Carousel to Homepage | JS seems to not be functioning

I've been trying to get the Bootstrap 4 Carousel to work on my homepage and I've been facing an issues that seems like the JS may not be functioning. This is the way that I went about doing so. I ...
1
vote
1answer
231 views

knockout js hiding button text

I am using knockoutjs to send ajax call and successfully am able to do that but when I click on update button the text on button gets to hide. <div class="field-group"> <!-- ko foreach: ...
1
vote
0answers
31 views

Install a BBB js into my pages

I have to install this JS script into my theme (paygo) in the bottom so I think it is the footer. I don't know where to start can someone tell me what to do. <!-- BEGIN: BBB AB Seal --> <...
1
vote
0answers
42 views

Magento Success/Failure Message for the Form Submission using Javascript

I am submitting the form to edit primary shipping and billing addresses via ajax (2 forms, 1 page), and it finally works like it has to. Now, I'd just like to add messages that magento sets for those ...
1
vote
1answer
484 views

Website freezes in checkout on a multistore Magento 2 installation

My default store works perfectly fine. I recently created a second store (each store is accesible through its own domain name) on the same magento installation and I noticed one error/bug in the ...
1
vote
0answers
113 views

Theme without require.js, knockout.js, AngularJS

I'm evaluating a the moment Magento2 as a solution for our Shop and I looked into a lot of Shops based on Magento2 to test the frontend performance and to be honest, I'm shocked. Every Shop I saw ...
1
vote
0answers
31 views

How to Text editor value display product image?

Please see this below image In this, the right has the text editor column and left side to have the product image frame. I need the text area value is display on image frame.how can I write this ...
1
vote
0answers
113 views

Error: Mismatched anonymous define() module error when integrating intl-tel-input with mageto2

I am trying to use https://github.com/jackocnr/intl-tel-input with magento2 on customer registration form for mobile number field to show country flag for choosing phone number but i am getting error "...
1
vote
1answer
685 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
1answer
55 views

custom js product page

I'm trying to execute a custom js on a product page in a way to get an color swatch selected on page load only if there is only one option. This is the script: var number = $('.swatch-attribute ....
1
vote
1answer
290 views

Magento 2: can't override js file

I tried to override magento/module-checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js For this in my custom module i have created under Module/Namespace/view/frontend, ...
1
vote
0answers
39 views

validation script ReferenceError

I got the following error some time on my website and after refreshing the page its work fine... with the validation script ReferenceError: validateOptionsCallback is not defined at eval (eval at ...
1
vote
0answers
26 views

need the CMS path directive for a app/code module folder

i added my own module under /app/code/my/module/ , activated it and put a java script under /app/code/my/module/view/frontend/web/js/myjs/myjs.js it works so far. The javascript is called within a ...
1
vote
0answers
693 views

Magento 1.9.1 I have added popup after clicking on addtocart button but the page is reloading before closing the popup

Magento 1.9.1 I have added popup after clicking on ad to cart button but the page is reloading before before closing the popup, Please let me know how can http://onlineflowersdelivery.com/new/index....
1
vote
0answers
748 views

Magento 2.2.2 - RequireJS domReady! not working with Slick Product Slider

Issue Slick slider breaking/not loading properly on page load and eventually breaking the product slider Solution: Load slick slider script after entire document is loaded and parsed ...
1
vote
0answers
22 views

Updating checkout validations without typing in the field

By default, the validations on checkout fields get updated on "keyup" of the field you're typing in. Is there a way to update validations when clicking a button or by some other action, that is not- ...
1
vote
1answer
225 views

Magento 2 : How to add Js and CSS using php in a page in frontend?

In Magento 2, How to add Js and CSS using php in a page in frontend ? What are the php methods in magento 2 for adding css and js in a page object?
1
vote
0answers
167 views

Magento 2.2 I want to add plyr.js for Vimeo video, I'm getting requirjs error and Class.extend is not a function, how to solve it?

Error 1) Class.extend is not a function. 2)RequireJS Error: Mismatched anonymous define() module: function (_, utils, wrapper) { 'use strict'; 3) I'm getting black screeninsted to Video. ------...
1
vote
1answer
18 views

Split Customer Account edit

i'm trying to split the customer account edit page to 2 column I tried /public_html/vendor/magento/module-customer/view/frontend/layout/customer_account_edit.xml this is my code <page xmlns:xsi="...

1 2 3 4 5 14