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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [requirejs]

Denotes questions related to require JS. RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments.

0
votes
0answers
7 views

How to hide particular admin form field(UI Component) based on the value of select field?

I used the following script to hide/show 'schedule_date' based on select field option change, and it is working fine. But I want to hide/display the fields without changing the select field options. ...
0
votes
1answer
17 views

Magento 2.1.9 - Cannot seem to overwrite JS comonent template in custom module

Having trouble trying to overwrite a JS component template at checkout. Here is my module structure and code for this specific task: app/code/MY/MODULE/view/frontend/layout/checkout_index_index.xml &...
0
votes
1answer
37 views

Use of non-amd jquery plugins with requirejs without modifying them?

I recently searched a lot on use of non-amd jquery code with requirejs but couldn't find a proper way to do it. To be more specific, I want to use pana-accordion.js found at below mentioned url. ...
0
votes
1answer
32 views

How to create auto call javascript multiple function in magento 2 in single file

I create two js file for a task. I want to merge two file task in one file in three function. Both two have different config parameter. I am using magento x init. <script type="text/x-magento-init"...
0
votes
2answers
26 views

Having trouble overwriting JS component in minicart dropdown

Having a tough time trying to overwrite the JS component and template around the product image in the minicart dropdown.Here's what I am trying to achieve: I have a custom Product Type depending on ...
1
vote
2answers
38 views

Module JS - Mismatched anonymous define module

I've tried adding my module JS file to Magento2 but for whatever reason it seems to return this error: Error: Mismatched anonymous define() module: function($) My view/frontend file structure: |-...
0
votes
2answers
40 views

Magento 2 How to override adminhtml Js components

Basically I want to override grid.js component file in Magento 2 Require config view/adminhtml/require-config.js Require config code. var config = { map: { '*': { ...
1
vote
0answers
10 views

Created node doesn't have attachEvent property

After updated magento from 2.1 to 2.3 I've got a require js error in console: Uncaught Error: Script error for: ModuleName I made an investigation and find out that require.js core file in the ...
0
votes
1answer
31 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
21 views

Magento 2 how to write in data-mage-init

Magento uses below way to show Requistition list using "x-magento-init". <div class="block block-requisition-list social-button" data-bind="scope: 'requisition_ - 111'"> <!-- ko template: ...
0
votes
0answers
4 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
1answer
37 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 ...
1
vote
1answer
109 views

Fresh Magento 2.3 Resource Files Not Working After Installed in Windows

Fresh Magento 2.3 installed in windows, after resource check and completed everything successfully installed, then if i open my website i am getting error like,
1
vote
1answer
24 views

Require.js errors after database restore

On Magento 2.2.6 I restored from an earlier database. After doing that I flushed the cache, reindexed the site,and deployed static content. I now get require.js errors on every page. On my category ...
1
vote
0answers
27 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 ...
0
votes
1answer
64 views

How to Load JS Code at the Top Using RequireJS

How can I load a custom JavaScript file using RequireJS at the very beginning? Please note: The key is that RequireJS must load my script FIRST, before any other scripts, as the rest of my script ...
0
votes
0answers
40 views

Remove calendar.js only from Magento 2 default homepage?

Do I want to Remove calendar.js from Magento 2 luma theme homepage? If I remove require.js from custom module it removes calendar.js and other all. Also, Can I remove the mapping of calendar.js from ...
1
vote
1answer
38 views

Adding JS to theme [duplicate]

I've seen a few similar posts on the Magento SE but none seem to work for me. I'm probably missing something but I for whatever reason my JS is not being included. I have a theme app/design/...
0
votes
0answers
27 views

Magento 2 EE : Override configure function(addbysku.js) of Magento_AdvancedCheckout module using mixins

In addbysku.js file, I want to override the configure function of Magento_AdvancedCheckout module using mixins in Magento Enterprise Edition. And my js code is, define([ /* eslint-disable strict */ ...
0
votes
1answer
107 views

Magento 2: Cannot read property 'dialog' of undefined, 'timepicker' of undefined,'RFC_2822' of undefined

Sometimes I'm getting following errors in the console after reloading the page:- Cannot read property 'dialog' of undefined Cannot read property 'timepicker' of undefined Cannot read property '...
0
votes
1answer
35 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
22 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 = {}; ...
4
votes
2answers
166 views

Magento 2 : How to call text/x-magento-init on Ajax success

I am in need to trigger some script with "text/x-magento-init" on ajax call but I am unable to do so. trigger('contentUpdated') contentUpdated is also not working in my case. I am using ...
0
votes
0answers
29 views

How to do AJAX call in js (widget) in magento 2

I wish to add ajax call while submitting the frontend form in magento 2 1)how to add jquery widget 2)How to make ajax call
0
votes
1answer
30 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 ...
2
votes
1answer
85 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
2answers
63 views

How to use third party jquery libraries in magento along with requirejs?

I am bit new to requirejs and currently learning AMD pattern in requirejs.I want to use custom third-party jquery libraries in magento. I have two questions: How to use jquery scripts that are ...
0
votes
1answer
88 views

Magento 2 - How to extend wysiwyg setup.js to add language settings?

i need to modify: setup: function (mode) { if (this.config['widget_plugin_src']) { tinyMCE.PluginManager.load('magentowidget', this.config['widget_plugin_src']); } ...
0
votes
0answers
22 views

Why would I use x-magento-init over declaring in XML

So I have a custom module in a custom theme and in the xml file of the module I'm declaring a js file. In that file I'm using the requirejs format to declare dependencies that are configured in my ...
0
votes
1answer
29 views

Datatable js include issue in magento2

I am including datatable plugin to my custom module. I tried in this way, below is the code of my Vendor/Module/view/frontend/requirejs-config.js var config = { map: { '*': { ...
1
vote
1answer
57 views

Extend Swatch rendered js file

How to extend the Swatch rendered js file in my custom module? I have override the phtml template files. <script type="text/x-magento-init"> { "[data-role=swatch-option-<?= /* @...
0
votes
2answers
37 views

Magento 2.2.5 custom theme js errors

I created a custom child theme for luma and it works fine. But when I extend the layout for Magento_Theme I start getting all kinds of javascript errors which are random, sometimes they don't appear ...
1
vote
2answers
22 views

Magento2 : Facing proble with call custom jquery function in Backend

I have to call custom jquery function into Magento backend (sales > Order > View) I have created custom js in adminhtml/web/js/order_status_validation.js require(['jquery'], function(jQuery){ jQuery(...
0
votes
1answer
107 views

How to add Slick Slider in Magento 2?

I have done the following to add slick slider autoplay in magento 2.. In my custom module requirejs-config.js var config = { map: { '*': { slick: 'xxx_yyy/js/slick.min', ...
2
votes
1answer
51 views

Why does one script work but not the other in require.js?

I am trying to add a live chat script to my Magento 2 site. I had previously added slick.js to my Magento 2 site and the require-config.js file looked like this- var config = { paths: { slick: '...
2
votes
1answer
96 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 ...
0
votes
1answer
24 views

using javascript in .html form Magento2

i have a custom form.html that displays at checkout. i want to have a javascript tag - when the form load just show an alert testing purposes. code i used below, "<script type="text/javascript"&...
2
votes
0answers
57 views

New Checkout Billing Address Form Field not saving value to the database

I have added a new checkout billing address form field for entry of an optional field for the customer. Have overridden the template checkout form and able to get the field onto the form, but cannot ...
2
votes
0answers
19 views

Trigger code on every popup

I wrote a specific code but it should run only when a popup is on. Not only a specific popup but all the popups on the site. How can I achieve it?
1
vote
2answers
36 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 ...
0
votes
0answers
126 views

jquery ajax not working in magento2

I am working on a simple custom module, where user can input height and the weight/BMI will be shown as output on form submit. The page where user enters input is Calculation Page while output is ...
0
votes
1answer
133 views

Magento 2.2 some JS files are not loading in production mode

In Magento 2.2.2 when setting website into production mode the following files are not loading, due to which my store switcher and other ui functions are not working in production mode: http://...
0
votes
0answers
87 views

Accordion not working Magento 2 after minify JS

I have minified JS and HTML and CSS in Magento 2. After that Accordion is not working. <?php $collectionTitle = $this->getCollectionFaqcat(); ?> <div class="shy-shadow-container row mrg0"...
0
votes
1answer
51 views

Product view error in admin panel Magento 2

Not able to view the product in the admin panel. getting below error in console. Unable to process binding "if: function(){return label }" Message: label is not defined I am not finding any fix for ...
1
vote
1answer
72 views

RequireJs and Custom JS file blur

this is my simple requirejs-config.js file var config = { deps: ['js/custom'] }; and this is my custom.js file define([ "jquery", "domReady!" ], function($) { "use ...
1
vote
1answer
83 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 ...
2
votes
2answers
491 views

Magento 2 : Add custom js to a single CMS page

I am trying to add custom js to a single CMS page in Magento 2.2.5. Here is what I got: I have put the rellax.min.js file at :/app/design/frontend/TemplateMonster/md/web/js And I want to use that ...
3
votes
1answer
56 views

Magento2 What is the difference between uiCollection and uiComponent

Refer to the file - vendor\magento\module-ui\view\base\requirejs-config.js You will see code in map like - uiCollection: 'Magento_Ui/js/lib/core/collection', uiComponent: 'Magento_Ui/js/lib/...
0
votes
0answers
35 views

Magento2: Custom Javascript Library not working for slider

I know someone will reply that this is a duplicate question and refer plenty of StackOverflow url. But trust me I have spent 24 precious hours of my life without any gain. I am about to complete my ...
0
votes
0answers
54 views

Site is not opening after setting production mode Magento2

I set mode as production, after that my website gone down, Is there any setting to be done? All css and js are showing 504 gateway error. What is the reason for it?