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.

669 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
228 views

Cannot read property '$' of undefined Error while using the instantsearch.js file of Algolia. Magento2

I'm trying to get all the data from Algolia so fro that I need to use instantsearch.js file of Algolia and also need to use algoliaBundle.min.js file but when I tried to copy this file then it gives ...
2
votes
0answers
25 views

UI Components - pass ids selection to listing selection

How do i pass a selection of ids to an insert-listing component to preselect certain rows. I have a dynamic rows component with entries related to the current product I'm editing. When click on a ...
2
votes
0answers
29 views

How to pass variable value from phtml JS to block.php?

I have a phtml (system.phtml) with <script> in it and a variable like console.log(data). <?php $checkcustomer = $block->Customerlogin(); ?> <script src="https://d3js.org/d3.v3.min....
2
votes
3answers
42 views

Magento bad execution on js and css

i have a issue when a try to access to my Magento Admin Panel and frontend default page. the admin panel always shows epmty And the frontend default page show content but without CSS and JS: how to ...
2
votes
2answers
295 views

Magento 2 secret key problem

I've a form that performs an Ajax call to a controller, but the response always is You entered an invalid Secret Key. Please refresh the page. PereiraTech/Faturamento/Controller/Adminhtml/Ac/Index....
2
votes
0answers
288 views

JavaScript Bundling Not working in Magento2

I have refered https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/js-bundling.html for javascript bundling: After doing all the step i have check Network in browser and it seems found ...
2
votes
1answer
3k views

TypeError: require is not a function

I add JS file in custom module Vendor\Module\view/adminhtml/layout/default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:...
2
votes
1answer
134 views

how to add onclick method in magento2 admin custom module page?

my edit.php file in magento admin custom module $this->addButton( 'approve', [ 'label' => __('Approve'), 'onclick' => 'deleteConfirm('...
2
votes
1answer
205 views

Magento 2 - problem with mCustomscrollbar.js

Since few days i try to fix issue with my mCustomScrollbar plugin and i got stuck. First of all i i've got library with mCustomScrollbar.js and mousewheel.js in web/js/mCustomScrollbar and my ...
2
votes
0answers
71 views

How to edit source of the index page in Magento

I am a professional PHP developer, it's been like 2-3 days since I am trying to work with magento. My task is to optimize the index page. Thing is, I can not edit the "actual" source of index page. ...
2
votes
0answers
258 views

Magento 2.2 x or 2.3 - to bundle or not to bundle

I've read so many conflicting write up's and blogs about whether to "Enable Javascript Bundling" or not. Some say it's slow and some say it's faster when enabled. From what I understand it takes all ...
2
votes
0answers
395 views

Should i use tinymce or tinyMCE in magento 2.3 and also usage for backward compatible

From magento 2.3 i see core team integrated new version of tinymce. It's a good thing. Maybe future they will add more editor for magento. But i have a confuse a bit when to use wysiwyg through below ...
2
votes
0answers
129 views

Magento2 error after theme upload: Invalid template file

After uploading new theme files (Hebes) to Magento 2.3 installation I receive the following error: 1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file:...
2
votes
0answers
120 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 ...
2
votes
1answer
295 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" ...
2
votes
1answer
376 views

Magento 2 TypeError Undefined products images not displaying / js not loading

At home page, product category view and product detailed view page images are not loading / displaying at firefox and less frequently at chrome. I am using magento 2.2.6 upgraded from 2.2.2 and porto ...
2
votes
0answers
108 views

Node modules in theme

I am new to magento and i have researched this issue i am having for enough time to post it here. My goal is to understand how require-js works with node modules. Case: $themeDir = app/design/...
2
votes
0answers
577 views

Mixin js file in Magento 2

I am attempting to override this file \vendor\magento\module-checkout\view\frontend\web\js\view\form\element\email.js First I create a requirejs-config.js file in C:\wamp64\www\magento222\...
2
votes
1answer
524 views

Magento 2 Missing JS function

Magento 2 Centos 7 Mariadb 10 When I try to add a product from the admin panel I get the spinning wheel of death. import-handler.js:44 Uncaught TypeError: component.getPreview is not a function ...
2
votes
0answers
171 views

minicart ko in magento2

Js file qtyOptions: ko.observableArray([]), initialize: function () { this._super(); for (var i = 1; i <= 4; i++) { this.qtyOptions.push(i); } return this; template file &...
2
votes
1answer
536 views

Callback function for “contentUpdated” event in JS

In Magento 2 we are executing data-mage-init and x-magento-init in dynamic content (ajax response) using using contentUpdated: <script type=“text/x-magento-init”> { "*": { ...
2
votes
0answers
165 views

On mobile submenu 'All %categoryname' is not translated - Magento 2

I can't translate the string 'All' from the subcategory on mobile menu. The file where the string appears is menu.js located on public/lib/web/mage/ And it looks like this: .text($.mage.__('All ') + ...
2
votes
0answers
659 views

Magento 2 Fotorama click event

Is there a way to fire a fotorama click event from a template file? What I am trying to do is have the functionality where, when the user selects an options from the dropdown from the catalog-product-...
2
votes
1answer
224 views

Something is overriding my onchange script?

I made a script that selects an option from a dropdown. The dropdown has onchange trigger and it trigger correctly when i run the script as a snippet (in a sandbox environment), but when i active the ...
2
votes
0answers
226 views

Javascript file 404s when loaded via Require JS alias

I've ran into a strange problem where a custom javascript file 404s when loaded via a RequireJS alias but it works fine when loaded directly. This does not work Require JS var config = { map: { ...
2
votes
0answers
614 views

Async loading of javascript in Magento for PageSpeed

I'm trying to optimize my Magento 1.9.3 website, following Google PageSpeed hints, saying I have js and css that load synchrounously and block the page rendering. To solve this issue, I'm putting ...
2
votes
0answers
151 views

JS mixin on a js file with a single return in Magento 2

I'm having trouble with mixin in Magento 2. I would like to override the following file to edit a function. Magento_Checkout/web/js/model/new-customer-address.js: define([ 'underscore' ],...
2
votes
0answers
133 views

Javascript load order

I need to load some JS libraries the last of all. I used to achieve this using data-group param, like this: <?xml version="1.0"?> <layout version="0.1.0"> <default> <...
2
votes
1answer
51 views

Add Javascript globally in Magento 2 backend

I have a custom extension that has a javascript file which need to run on every page in magento 2 backend to use jquery and ajax function, is there a way to do this action with custom extension?
2
votes
1answer
864 views

magento 2 spConfig access

how can i access the spConfig variable in a custom function on product view page. <script type="text/x-magento-init"> { "#product_addtocart_form": { "...
2
votes
0answers
457 views

Magento 2 : How do I hide a Customized Checkout Step

I have added a custom step in checkout. I would like to use some JS to hide or disable the step based on if the associated shipping option is selected or not. I tried to wrap it in if statement but ...
2
votes
0answers
435 views

Checkout Page - JavaScript can't target inputs

On my checkout page I'd like to do some JavaScript on Inputs and other elements. It seems like I can't access certain part of my page. To verify i tried $("form").html("these forms I could find"); ...
2
votes
1answer
114 views

Store view with messed up CSS

I have set up a German view in addition to the current default view and the css is messed up when I change the language. It looks like it goes into mobile mode. The website is http://m.theseolounge.co....
2
votes
0answers
252 views

Magento hangs when I click Save and Continue Edit

Windows 10, Magento 2.1, XAMPP, Stores > attributes > product > add new attribute > properties fill in [Default Label] and click — Save and Continue Edit. It says please wait... and the software ...
2
votes
0answers
524 views

Add full version of jquery mobile to magento2

Magento2 loads by default a custom build of jquery mobile library: deps: [ "jquery/jquery.mobile.custom", If I try to add the full version of the mobile library (require it in my theme): var ...
2
votes
2answers
1k views

Auto Select colour Swatch when configurable product page loads

I have a configurable product with one colour and different sizes, both these are set as required fields. I've set the colour attribute as not required, but then it wont show up when I create a ...
2
votes
0answers
1k views

Where to add Mailchimp Subscriber Popup code in magento

I apologize if this question has been posted before, but I checked all over google and could not find anything. I am trying to add the Mailchimp subscriber popup to my homepage, but cannot figure out ...
2
votes
1answer
660 views

Update price without refresh the page

I am working on magento2 customization calculation functionality. In this i have width and gather two field is there in text field I have to calculation with product price eg. pricewidthgather like ...
2
votes
0answers
799 views

Magento SOAP API: How to get SOAP response using JavaScript

I'm able to get SOAP response using Magento SOAP API by using PHP code. Now I want it using JavaScript/AJAX request. How can I accomplish this? What steps should I follow prepare my Magento to allow ...
2
votes
1answer
1k views

Drag and drop category error

I get There was a category move error. on moving(drag and drop) subcategory to another root category. How I debug this? on console I get Expected to start loader but did not find one in the dom this ...
2
votes
0answers
606 views

Adding custom xml to CMS page's Layout Update XML fails to load the script

I am trying to add Java script to a specific CMS page to be loaded in the <head> area. The scripts fails to load. name.min-1.0.js and name.Mode.js are placed in {magentoroot}/js. The ...
2
votes
0answers
4k views

Swatch customization issues

well we have heavily customized Magento 2 website. The swatch customizing is done in: app\code\My_Package\CustomSwatches\view\frontend\web\js\SwatchRenderer.js by overriding: vendor\magento\module-...
2
votes
0answers
677 views

Web service API SOAP v1 using java for connect?

In official site exists this faq http://www.magentocommerce.com/api/soap/introduction.html And in line As of v1.3, you may also use the following URL to access the Magento API v2, which has been added ...
2
votes
1answer
343 views

Magento 2 How to add external Js in a page

I want to add an external js in my home page. The external js loads a popup form in my home page. I have tried the code in phtml file and also in xml file. In both case the form will appear. But some ...
2
votes
1answer
2k views

Knockout JS removes jQuery change event

I don't know if it is specific to Magento 2 but an already set up HTML node with jQuery change event attached to it will lose its change event when run inside a knockout component with attached VM (...
2
votes
1answer
2k views

Magento2 Get Customer Custom session Data in Javascript file

I am trying to get the custom session data of Customer in a javascript file. As I am passing 'Magento_Customer/js/customer-data' as dependency in order to retrieve the data. define( [ ...... '...
2
votes
1answer
63 views

Magento 2.0.2 js not loaded

Magento 2.0.2 giving error -Failed to load resource: the server responded with a status of 404 (Not Found)
2
votes
2answers
1k views

Magento 2 : How to Implement Swiper Plugin

I'm trying to convert html template to Magento 2.1.3. I started my conversion using blank-sass from Snowdog. Some CSS was sucessfully implemented but I can't figure out many points. One of them is how ...
1
vote
2answers
35 views

How to Validate Special Characters in Magento 2 Validation Mixin

I want to validate special characters in a custom validation mixin file (validation-mixin.js) When I am using this validation mixin for my input field, i.e. a Purchase Order Number in checkout, it ...
1
vote
0answers
13 views

Define an event on select with event observer

My template is located in src/app/design/frontend/MySite/default/Magento_Checkout/templates/cart/item/default.phtml There is a select and in this select I'm adding an event. <select id="cart-<?...

1 2 3 4 5 14