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.

658 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

Magento 2 implement Readmore.js from jedfoster

I want to implement Readmore.js to our Magento 2 store. See: https://github.com/jedfoster/Readmore.js For some reason it does not work, maybe due to conflict jQuery with default Magento 2 code? Is ...
0
votes
1answer
54 views

Remove alert.js file from magento 2

I want to remove alert.js file from my DOM. following is the file location "vendor\magento\module-ui\view\base\web\js\modal\alert.js" I tried so many ways in my child theme's default.xml file <...
0
votes
0answers
15 views

Passing data as Javascript variables without caching

I've made some modifications to Magento's swatches via a custom module to display out of stock options on the product page (as non-selectable deactivated swatches, so the user will know that the ...
0
votes
0answers
37 views

Magento 1.9.2. - JS and CSS that block the view above the fold

I'm searching the web for a definitive solution to the "problem" that google reports when i test the speed of my site on Google PageSpeed. Magento's JS and CSS block the above-the-fold view and I ...
0
votes
0answers
16 views

I can't disable event FacebookPixel in Checkout page

I have created a module to install facebook pixel on magento. My problem is when I created the disable page view function. It disabled on the url: http://localhost/magento2300/checkout but when I ...
0
votes
0answers
162 views

Mailchimp popup not working

I am trying to add a mailchimp popup to my magento site. So in the footer.phtml I added this: <script type="text/javascript" src="https://downloads.mailchimp.com/js/signup-forms/popup/unique-...
0
votes
1answer
525 views

Magento 2: Including External JS - Uncaught Error: Mismatched anonymous define() module

Trying to include an external JS file on a specific page. Currently using the following in my layout: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
20 views

Payment method buttons sometimes work sometimes no

I need a little help, sometimes the buttons of the method payment doesn't work, I can't find what is going on, in the most of the cases they work.
0
votes
1answer
95 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
319 views

Invalid Return Type in Ajax Call

I made an ajax script to (at the moment) simply return some HTML to a select. My function looks like this: $.ajax({ showLoader: true, data: {val: inputVal}, /*dataType: 'json', (un)...
0
votes
1answer
65 views

I upgraded from 2.1.9 to 2.2.7 but css and javascript is not working

I tried to upgrade using these commands : composer require magento/product-community-edition 2.2.7 --no-update composer update rm -rf var/di var/generation php bin/magento cache:flush php bin/...
0
votes
1answer
510 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
0answers
38 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
3answers
594 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
57 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
57 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: ...
0
votes
0answers
48 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
144 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(){ ...
0
votes
2answers
307 views

Magento 2: Override js in custom module doesn't work?

I'm trying to override js in custom module, but that module which i want to override is already override some js from magento_checkout. And seem like it doesn't work :( Here is how i did: That ...
0
votes
1answer
17 views

Sometimes getting cannot read property issue after page load due to which some functionality affected

On the entire website(homepage, category page etc) sometimes I'm getting "cannot read property timepicker" issue due to which some feature like "Add To Quote" functionality affected & instead of "...
0
votes
1answer
146 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"&...
0
votes
0answers
206 views

Js error when first time loading site magento 2 in chrome browser

Js error when first time loading site magento 2 in chrome browser. Firefox, and explorer no problem. One of the problem is here. http://prntscr.com/kso59y
0
votes
1answer
382 views

requirejs ! bootstrap.min is not loading in Magento2

I am doing theme integretion. I have included the bootstrap.min.js file in requirejs-config.js in requirejs-config.js file var config = { map: { '*': { 'jqueryjs': 'India_Newtheme/js/...
0
votes
0answers
295 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
0answers
145 views

Mganeto2: doesn't exist or not a file .js

In exception log file I get every time issue: [2018-08-26 10:41:56] main.CRITICAL: The path "/home/czasowe/domains/domain.com/public_html/var/tmp/_cache/merged/dff080226ea3597444c03925cb09364e.js" ...
0
votes
1answer
73 views

CSS/JS not loading - Permissions error?

I seem to have had a permissions error in var and specifically var/cache. Both were previously set to 755, which has not caused issues before. This morning my CSV files stopped being generated by ...
0
votes
1answer
117 views

API POST using javascript

I'm attempting to do an API post but I get the following error, 405 (Method Not Allowed) Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is ...
0
votes
1answer
34 views

Spinner Icon is not visible

I would like to display a spinner icon when the user clicks the HTML form submit button and want to hide it when the data is posted to the destination URL. But, In my case, It's not working. Below is ...
0
votes
0answers
273 views

How to solve jquery issues in Magento 2?

I am using Magento 2.2.3 and I have created customtheme But in my website scripts are not working properly.It gives me below error: ReferenceError: jQuery is not defined I have added requirejs-...
0
votes
2answers
237 views

Magento 1.9 - problem with librabries conflict - nouislider.js and prototype.js

I have in code following libraries: <script type="text/javascript" src="http://localhost/js/lib/jquery/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="http://...
0
votes
0answers
59 views

Form validation in magento2

Here is my template file content. <form action="#" method="post" id="newuser_form"> <input name="form_key" type="hidden" value="<?php echo $FormKey->getFormKey();?>"> <div ...
0
votes
1answer
29 views

Add .js file in root folder from xml, Magento version 1.9.3.8

Is it possible to add in xml configuration .js file from root folder. In root folder we have the folder js_components. How can I add a file in xml? I can not move this "js_components" folder in ...
0
votes
0answers
97 views

how to store javascript variable in php

<script type="text/javascript"> function myFunction(){ var x = document.getElementById("billing:postcode").value; <?php $pincode = "<script>document.writeln(x);</script>"...
0
votes
0answers
49 views

How to execute js code for a specific product?

I need to execute javascript code for one specific product on the product page. How can I do that? Magento version: 2.2.5 I found some answers on the web, but they don't work for me: 1) custom js ...
0
votes
1answer
213 views

JS doesn't load when change mode from development to production in Magento 2.1.9

Website working properly in developer mode when I am changing mode from development to production. JS doesn't load after change mode of production. Below Error: GET https://example.com/pub/static/...
0
votes
0answers
499 views

Magento 2: Can't complete checkout because of unexpected character of the JSON data

After filling the shipping information in the first step of checkout, I click on the "Continue" button and the site stops responding. The spinning wheel appears but it is not possible to click on ...
0
votes
1answer
47 views

A Custom module that uses a JavaScript script breaks functionality

I have created a custom module that is simply a link that shows a modal with a picture on it. I have connected the module with an attribute and the module works for that specific product attribute. ...
0
votes
0answers
137 views

Uncaught TypeError: $(…).hideshare is not a function

I am getting this error when I open single product page. Due to this page is not getting load. I have done some workaround for this... but did not get any clue. it is theme based issue. I am using ...
0
votes
0answers
77 views

The best way to add an extra attribute to checkout shipping form fields

I want to know the best way to add some extra attributes ('disabled' & 'readonly') in shipping checkout form. I found some workaround to bind a js in knockout but my js is loaded before the form !...
0
votes
1answer
46 views

Mails and messages are not being sent after successful order placement

Few days before I had minified all the JS files in my Magento store and after that, both the mails and the messages that we had configured to fire on successful order placement is not working. Is ...
0
votes
1answer
67 views

How to check number file uploaded reach to limit in component uploader

I have created my own fileuploader base on magento component. I want to check file number when it reach to limit define( [ 'Magento_Ui/js/lib/validation/validator', 'Magento_Ui/js/form/...
0
votes
1answer
129 views

what is the equivalent file of opcheckout.js(which is in magento 1) in magento 2

Magento 1 /var/www/html/xxx/skin/frontend/base/default/js/opcheckout.js Magento 2 What is the equivalent file for above one in Magento 2.
0
votes
0answers
26 views

Magento 2.1 : How to pass variables from PHP to the browser in observer

What I need to do is: When the event 'checkout_cart_save_after' is dispatched, get the cart data (sent in the event dispatch) with an observer. Then i need to send this data to the browser (with JS) ...
0
votes
1answer
422 views

Magento 2 : How Can I Override Step-Navigator File From Checkout

I want to override step-navigator js file. I had followed this method How to extend js class/method of checkout model class in magento 2 but it didn't work. any help. I want to override this method. ...
0
votes
1answer
113 views

I have magento 1.9.4 and running 3 stores and want to add a jv script from duda in the head

It says to add this to the head section but I don't know where it is. This is the script. DM_redirect("m.stuffwholesale.com"); I looked at the phtml which I found in the forum but I just am unsure can ...
0
votes
1answer
24 views

Product AddToCart Product list page magento 1.9.1

I am using JavaScript function to add product to cart, below is my JavaScript code : <script> function myFunction() { jQuery.ajax({url: '<?php echo $this->helper("checkout/...
0
votes
2answers
935 views

Uncaught TypeError: $el.ColorPicker is not a function Magento 2

Magento ver. 2.0.18 I created a custom module in backend there is color picker options. for this i used this link color picker answer of @EmizenTech it works perfectly but some time it gives and if ...
0
votes
1answer
515 views

How to pass a value to modal while opening

Is it possible to pass a value while opening a modal(js component of magento)? If the answer is yes, then how can i do it?
0
votes
1answer
320 views

Render minicart without dropdown dialog

I want to move the minicart to an offcanvas sidebar (foundation 6). I was able to move the minicart vial layout. But it keeps rendering as a dropdown dialog (magento ui) so I would like the cart's ...
0
votes
1answer
324 views

Two functions on submit button Magento 2

i want my vendor registration form to show a video popup when click on submit button. <button type="submit" id="save" class="action submit primary" onclick="submit"title="Save"><span><?...