Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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 ...

0
votes
1answer
11 views

jquery plugin error “Uncaught TypeError: $(…).[plugin function] is not a function”

I am using Magento 2.2.6 and I am trying to include a jquery plugin (stickybits, in this case). The jquery plugin file is successfully called in my requirejs-config.js file and I can see that the file ...
0
votes
0answers
3 views

Integrating Magicsearch(autosearch) plugin into Magento 2 but getting Magicsearch JS error in console

I'm integrating "jQuery Magicsearch" plugin into Magento 2,you can get Magicsearch plugin from here:- https://www.jqueryscript.net/form/Dynamic-Autocomplete-Multi-select-Plugin-With-jQuery-...
0
votes
0answers
8 views

Magento 2 | How to inject JS element on Sales order grid page?

I want to add custom dropdown menu above sales order grid as: What should be the way to achieve this ?
0
votes
2answers
11 views

How to add custom js to the order_status.phtml

I want to add custom js to the order_status.phtml file. where to add the js file and link it to the order_status.phtml
0
votes
1answer
18 views

Trying to override magento2 product view breadcrumbs

So i tried to change the breadcrumbs.html JS template for magento 2.3 product view breadcrumbs in <themedir>/Magento_Theme/web/templates/breadcrumbs.html, but ive been stuck on this for half a ...
0
votes
1answer
23 views

Adding JS File To Module

I've been following a few guides online about adding a JS file to a module but it seems to be going awry for a reason I can't figure out. My JS is a simple file: define([ 'jquery', '...
0
votes
0answers
16 views

How can I increase the speed of my Magento website?

I have a system in magento ready and running, but the speed of the web is not very good. Here you can see a sample of how the web works: https://developers.google.com/speed/pagespeed/insights/?url=...
1
vote
0answers
28 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, ...
0
votes
0answers
10 views

The discount code can't be used automatically after a while?

I have set a discount code on the backend of the website for the convenience of customers. But every once in a while, the user can't use the discount code. I also retested, it is true, can not be used,...
0
votes
3answers
22 views

How to add custom js file in Magento 2 in custom theme without use module

I used custom theme in magento 2. I want to add custom js file for navigation in magento 2 but js file not work. I add js link in default_head_block.xml but a js doesn't work. <link src="js/menu....
0
votes
0answers
24 views

Magento 2 - Request from Javascript is returned with Status code 302

I´m sending a POST request with data via XMLHttpRequest. The response that I´m getting do have the status code 302. Javascript function: function createCSV() { let xhttp = new XMLHttpRequest(); ...
0
votes
0answers
29 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"> { "*": { "...
0
votes
1answer
20 views

Advanced js bundling

I try to optimize the bundles of magento with the information from devdocs . I try to do it on Magento 2.2.6 but the main issue is that after generating the bundles I get an error from the customer-...
0
votes
0answers
4 views

How to solve Grunt Error “Warning: Task ”clean“ not found. Use --force to continue.”

I am creating new theme in magento 2 . refering This Link TO make theme but grunt giving me error as attached in question. Code of dev/tools/grunt/theme.js is as following module.exports = { theme:...
0
votes
0answers
15 views

Magento 2 - checkout page loading but not stoping

when ever i click next for check out page some time still loading some times shows empty page How i can fix this....
0
votes
2answers
24 views

How to solve Unable to load CSS and JS after setup magento 2

My using Ubuntu 18 and apache2 I downloaded magento2 zip file and extract uploaded to my /var/www/html/ but always shows the above image I already setup htaccess file Already tried comments: ...
1
vote
1answer
28 views

JQuery how to remove tr in table which are display none in CSS [closed]

how to remove tr in a table which is display:none in CSS
0
votes
0answers
15 views

Magento 2.2: Is it possible to use Vue.js in Magento?

If is possible, how can I integrate it in my custom module?
0
votes
0answers
5 views

M2 | If click on eidt button, update button should become visible and edit hides

I have to update a record. I have gone through this but it is in M1. I have my code in custom phtml file and my function that changes value is: $changeEmail = $block->changeGuestCustomerEmail(); ...
1
vote
0answers
25 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
18 views

How to include custom JS to admin create new product in magento 2

I want to include custom JavaScript to create new product form. I already try with below way Using XML way. app/code/Namespace/Modulename/view/adminhtml/layout/index_index_add.xml <head> ...
0
votes
0answers
21 views

Product admin edit issue in magento 2

I am getting below error in console, when i try to edit product in admin Uncaught TypeError: data.some is not a function Referred below link and used that didn't solve my issue. Uncaught TypeError:...
0
votes
0answers
15 views

How to render HTML in x-magento-template?

I have used this blog https://webkul.com/blog/how-to-write-javascript-template-in-magento2/ to use x-magento-template. In this I can render data using such code: <%- data.name %> But it shows ...
1
vote
1answer
29 views

Buy On Amazon button

I want to add "Buy on Amazon" button on my product page. I was successful in adding it with this code: <a href="<?php echo $this->getProduct()->getamazonurl(); ?>"><img src="/...
1
vote
2answers
48 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 ...
0
votes
1answer
15 views

The number of “Requests” is very large

I tested my website performance with Gtmetrix. I found that my website performance seems to be good, but the number of “Requests” is very large. I want to know if the impact of this problem is big? If ...
1
vote
2answers
100 views

Passing magento username and email variables into js script (Magento ver. 2.1.8)

<!-- Head --> <script src="https://wchat.freshchat.com/js/widget.js"></script> <!-- Head --> <script> window.fcWidget.init({ token: "WEB_CHAT_TOKEN", host: "...
0
votes
2answers
37 views

How to solve “One or more indexers are invalid. Make sure your Magento cron job is running” [duplicate]

My magento 2.2.1 website backend prompts "One or more indexers are invalid. Make sure your Magento cron job is running." How to solve this kind of error? Does it have a big impact?
1
vote
2answers
39 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:/...
0
votes
0answers
28 views

Magento 2| How to add “Add to cart” Button functionality in jQuery?

I am adding "Add to cart" button functionality in jQuery function for calculated product quantity. I have add simple button yet. I have doing it as: My function is: $(document).ready(function(){ ...
1
vote
1answer
31 views

Why are browsers failing to load some static content?

Using Magento 2.2.6. I just installed a brand new install of 2.2.6 using Apache on OS X High Sierra, and with both Chrome and Firefox, after logging into the admin, the subnavigation does not work, ...
0
votes
1answer
21 views

Custom Javascript in magento 2 backend

So far I have created my custom widget and I need to pass custom javascript code to my widget in BACKEND (not frontend), how can I do this? The trickiest part is that the widget gets called using AJAX ...
0
votes
0answers
6 views

Magento 2 opens the product page sometimes reminds error?

Magento 2 opens the product page and sometimes prompts [Identifier "" not exist.] This error sometimes does not prompt. Is this what is the reason?
0
votes
1answer
39 views

Magento 2 - Pass data from php to javascript in widget

I have an custom widget in admin panel which has select option with all available categories in the store. How can I pass this data to my javascript file? I want to get array of all loaded categories ...
1
vote
0answers
17 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
62 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
15 views

Mini Cart Update issue

I am facing mini cart update issue - to replicate the issue you need to browse the site and add a product to the cart - then continue shopping. If you press checkout (instead of continue shopping) the ...
0
votes
0answers
62 views

Uncaught TypeError: Cannot read property 'options' of null magento1

i am getting error at klass.initialize (eval at <anonymous> ((index):1), <anonymous>:13:360) on form.js line no 178 if (this.regionSelectEl.options.length<=1) in magento1
0
votes
1answer
23 views

Error message display using js in backend

I want to display an error message on the form/listing in magento 2 back-end. I know how to show those message using a controller. But how can i achieve same with JavaScript.
0
votes
0answers
62 views

Text swatches not selecting

I'm using a block to render swatches on the homepage of my website. I have used this before and it has worked perfectly. However, it's now not working and I can't figure out why. The swatches don't ...
0
votes
1answer
24 views

Can't add custom script (leaflet) to Contact page

I'm trying to add a map in Contact page. In order to do that,I did the following: In file: app/design/frontend/MyCompany/MyTheme/Magento_Contact/layout/contact_index_index.xml I added: <page ...
0
votes
0answers
21 views

Minicart issue Magento 2 Safari only

We have - Magento 2.2.6 - Varnish, Redis Working on mobile and pc. But just not in Safari browser. In safari browser following issue: Go to product page Click 'add to cart' -> goes to cart ...
0
votes
0answers
15 views

UI Component - Disable Fieldset Collection

I want to figure out a way to take a <fieldset> collection (ex. customer's addresses), from a form ui component, and disable it due to a certain value of a field like a select drop down. The ...
0
votes
0answers
16 views

Magento2 jasmine unit testing

I'm trying to get Jasmine Unit Testing to work. I got in my file inside location: {vendor}/{module}/view/frontend/web/js/test.js define([ 'jquery' ], function ($) { var modu = {}; ...
0
votes
0answers
24 views

Magento 2: admin base URL for UI Components

There is BASE_URL variable on the adminhtml pages (see ./vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml): <html> <head> <script> ...
0
votes
1answer
27 views

Modified JS file not changing Magento 2 Backend paging grid

I'm currently attempting to change the "sizes.js" file using a child theme in adminhtml. This is with the "Commerce" version of Magento 2.2.5. As we have a large number of customers and orders. What ...
0
votes
0answers
8 views

Loading default image failing with quote in name

I have several product in my store. Some of them have no image and have quote in the name Example of name: My product "a detail" This is causing this issue : SyntaxError: JSON.parse: ...
2
votes
1answer
72 views

Upgrade to 2.2.6 missing static JS files

When I upgraded my Magento 2.2.2 to 2.2.6. I got one critical error in pub/static missing one file named trim-input.js "pub/static/version1540806968/frontend/{...}/{...}/pl_PL/mage/trim-input.js" ...
0
votes
1answer
48 views

Override Magento UI js file

How can I override this file on my theme? /vendor/magento/module-ui/view/frontend/web/js/view/messages.js I'm a newbie to M2
1
vote
4answers
84 views

I want to translate “Buy” and “save” word in tier_price.phtml file. magento 2

I want to translate "Buy" and "Save" word in tier_price.phtml file.I have added the word in translation csv file but it is not working form me. Refer screenshot PATH : vendor/magento/module-...