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.

744 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
113 views

requirejs error in my child theme

I can't find where this error comes from my custom child theme. Error: Script error for: priceBox http://requirejs.org/docs/errors.html#scripterror Error: Script error for: jquery/jquery-...
0
votes
0answers
716 views

Cookie to display popup only one time on homepage

I want to set a cookie to display my popup only one time on the homepage. Any suggestions how can I do that? Here is the code of , my newsletter popup <page xmlns:xsi="http://www.w3.org/2001/...
0
votes
2answers
1k views

Magento 2 include google maps js only on contact page

I have a custom theme based on Luma, I'm trying to include google maps script only on contact page but it's not working. Here is my contact_index_index.xml file under my-theme/Magento_Contact/layout/...
0
votes
1answer
50 views

JS errors in checkout and the page can't stop loading

On a fresh installation M 2.2.2, checkout page can't load some JS files, and the page cannot stopping loading, I tried to insert them manually but no success !
0
votes
1answer
43 views

getting a syntax error when trying to upload to my site

I cannot upload product images, I cannot upload images in a cms block through the wysiwyg. I am getting this error: I went ahead and replaced all of the .js files with the original download files, ...
0
votes
1answer
44 views

How to add Long Texts below footers for different cms pages in Magento 1.9

I want to put text after the footer links for SEO purposes for my Magento website. I want different texts to be shown below the footer for the homepage, categories and the products. As an example, ...
0
votes
1answer
155 views

Need product id dynamically in a button which is appended through javascript in magento 1.9

I am creating an extension of products quick view. For that, i have given an option in admin panel to choose if a user is using custom template or default. if he uses default template: in that ...
0
votes
1answer
343 views

Magento 2.2.2 Javascript Bundle error

I am currently using Magento 2.2.2 and all is fine with JS bundling and minifying off. However, when I enable js bundling I get a JavaScript error. I think this is related to a require.js config file....
0
votes
1answer
68 views

Message shows when user is logged in

I want to show a message in a when the user is logged in under customermenu.phtml, what is the best way to do it?
0
votes
1answer
70 views

How to add a JavaScript tag attribute in Magento 2?

What is the proper way to add a js tag attribute in Magento 2? This is needed for example for Cloudflare Rocket loader to ignore a certain script. <script data-cfasync="true" type="text/...
0
votes
0answers
46 views

How can I remove js of disabled extensions in my js bundle?

I am not very deep into Magento, so I might just have missed something. I am using the JS Bundling feature, and I've read there are quite some issues. As with many other people, the resulting bundle ...
0
votes
0answers
68 views

Bundle options could not be deleted from admin - js issue

I have bundle options more than one page. While deleting one of the options on the first page, the bundle options from the second page are getting deleted. This seems to be a Js issue in ...
0
votes
0answers
8k views

Add/Remove class when scrolling over section / Sticky sidebar

I want to add the class 'sticky' when scrolling over the div with class="product-options-sidebar" and remove the 'sticky' class at the end of the <section id="options">. This so that the div ...
0
votes
1answer
20 views

Add to cart function doesnt work on product pages

Since activating the Porto theme on my magento site the add to cart function hasnt worked on the product pages, but still works on the catalogue views. Does anyone have suggestions? http://dev.tec-...
0
votes
1answer
57 views

How to trace which file adds js script

I'm working on a 1.9.3.6 project in which the header has <script type="text/javascript" src="http://mage1936.local/skin/frontend/mytheme/default/"></script> that causes a 403 console ...
0
votes
1answer
1k views

Get quantity in stock for items added in cart in JS

I need the quantity available for each product in cart in my custom javascript file. Does anyone know how to do this?
0
votes
1answer
42 views

Blank Page Issue during creating an order from the Backend

I've tried to disable all the third-party modules by deactivating without any luck. So, I checked from the console and I found the following: I just want a hint in where I should start.
0
votes
0answers
56 views

JavaScript Not Showing in File

Trying to add some custom JS to my module. The file is called in the <head> section, but theres no code in the file called. /view/frontend/web/js/fitmentsearch.js define([ "jquery" ], ...
0
votes
1answer
98 views

Avoid caching image caching

is there a way to add versioning for the product image? I'm having trouble with image caching in the site, i can't control user browser for caching but maybe i can add a versioning for my images when ...
0
votes
2answers
2k views

Confirm Password Validation Not Working

I have an issue with the confirmation password validation on creating the account and reset password pages and showing the following error although the passwords match? Please enter the same value ...
0
votes
2answers
813 views

Magento2: Many .js requests. How do I merge js files?

I see over 130 requests to retrieve .js files, and I think it is a reason why the magento2 site is so slow. How can I optimize it? I've already set merge and bundle js files in admin, but it's not ...
0
votes
1answer
47 views

Javascript translation doesn't work

I've got problem with default translation built in magento 2. A made static content deploy, file js-transation.json generated properly but strings didn't translated. Site: test-php.pl Version magento ...
0
votes
2answers
2k views

How to Magento 2 Enable JavaScript Bundling

I merged JS and CSS file Stores -> Configuration -> Advanced -> Developer -> Javascript Settings in production mode of magento2. Once, I check via view source of the page, I can see the Javascript is ...
0
votes
1answer
445 views

Show popup message before check for login

I tried to show a popup message when customer tried to login. I add some code in LoginPost.php like in code below but it's not work. LoginPost.php : try { echo " <script type='text/...
0
votes
2answers
366 views

What does this error mean and how can I solve it?

I have been seeing this error in the console: Uncaught TypeError: Cannot set property 'touchstart' of undefined at String.<anonymous> (jquery.mobile.customized.min.js:10) at Function.each (...
0
votes
1answer
292 views

store config values in javascript

I have my store config value as below Mage::getStoreConfig('passwordmeter/validation/is_contain_special_character'); How can I Call this value in javascript variable or loop??
0
votes
0answers
614 views

Uncaught TypeError: Cannot read property 'fadeToggle' of null

I wrote this little Javascript to hide .price-box: jQuery(document).ready(function(e) { var visible = window.localStorage.getItem("visiblestate"); if (visible != null){ var el = $('.price-box'); ...
0
votes
1answer
665 views

dropdownDialog widget cant listen to dialogopen

I wanted to add some custom animations to my minicart and therefore I have to listen for dialogopen and dialogclose events. The script is loaded and executed but all my attached listeners are not ...
0
votes
1answer
1k views

Magento 2 How to add custom grid

How can I add this code in Magneto2 admin page. <html> <head> <link rel="Stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" /> <script type="text/...
0
votes
1answer
275 views

Magento2. Use non AMD javascript scripts

I am trying to load an external javascript in my Magento 2.1.x installation in this way: <script type="text/javascript"> var _iub = _iub || []; _iub.csConfiguration = { ...
0
votes
1answer
289 views

How to create new js file and override the one from extension - Magento 2

So, I have a js file from an extension, that I need to override the path is: app/code/MyExtension/MyExtensionSubfolder/view/frontend/web/js/script.js Where should I put the new JS file so that it ...
0
votes
1answer
355 views

Add third party tracking code to sales_quote_remove_item event

I am working on the process of integrating third party tracking code into Magento 1.9.3.3 and managed to add tracking for customer registration, Add to cart, Successful checkout. But Remove an item ...
0
votes
1answer
2k views

Lots of jQuery conflicts on Magento 2

I'm working on a new Magento 2 installation with the Porto theme and have noticed that when you first visit the site or have the browser cache disabled you get a lot of of jQuery conflict errors. ...
0
votes
1answer
885 views

Add JS to head in Cart

I have problem when I want to put JS into head when PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type excetion no idea why. I have read all the possible issues I have found ...
0
votes
0answers
193 views

Trigger custom js script by using Magento observer

I need to trigger some custom js script in Magento for following actions, 1) customer account creation (customer_register_success) 2) Add to cart action (checkout_cart_product_add_after) 3) Remove ...
0
votes
1answer
334 views

1.9 Validation returns true but error message appears when other are wrong

I've implemented a new function to validate a single date field with format 'dd/mm/YYYY'. It works well but if another field is wrong, it's error message appears. Here is my js var frenchDateReg = /^...
0
votes
2answers
613 views

Magento 2: $.widget is not a function

When I go to the Checkout on 2 different devices, I get different console errors. On a DELL laptop I get the error on domain.com/checkout: $.widget is not a function (dataPost.min.js) Cannot read ...
0
votes
1answer
621 views

Debug translations - Magento 2

some strings on the site are not translated. are present in the translation dictionary and apparently correctly compiled. what could be your problem? I forced some of these strings using online ...
0
votes
0answers
132 views

Magento 2 : JS issue at the time of enable bundle js

I am trying to enable bundle js feature but getting this issue on product view page SyntaxError: missing ; before statement </div>'}}(window,document,location,"undefined"! Any one have ...
0
votes
1answer
948 views

Magento 2: Global variable doesn't work with RequireJS

I'd create a HTML document with a script tag and add this URL <script src ="https://assets.pagar.me/pagarme-js/3.0/pagarme.min.js"></script> so, call the global variable pagarme in ...
0
votes
1answer
293 views

Adding AMP JS library to Magento using XML

Requirements: Add <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script> to the head of the page Problem: JS library needs to be ...
0
votes
1answer
103 views

How to get all product images in modal slider?

<div class="pdp-media"> <a class="product-image" href="<?php echo $item->getProductUrl(); ?>"> <img src="<?php echo $this->helper('catalog/image')->init($...
0
votes
2answers
364 views

Newsletter Popup Submitting But Not Closing

It was working when I first installed it. Now I'm finally ready to try to use it it's not completely working. It Submits the form and it registers in magento backend in the newsletter subscribers but ...
0
votes
1answer
62 views

js observe for field validation flickering

I am using this script: <script type="text/javascript"> $('street_1').observe('keyup', function(e){ Validation.validate($('street_1')) }); </script> Which on keyup ...
0
votes
1answer
470 views

How do I get the Bing Revenue Conversion tracking to work on Magento?

I am using Magento 1.9.1. I have Google Analytics ecommerce tracking working fine but the same thing will not work in Bing Ads. <?php $orderId = $this->getOrderId(); $order = Mage::getModel("...
0
votes
1answer
11 views

i need to link the js file in admin inside pdate layout xml tab in magento 2

I need to link a JS file in admin inside update layout xml tab in magento 2 please give if you any solution. <head> <script src="js/productcollection.js"> </head>
0
votes
1answer
85 views

Javascript loading issue in Magento

I am loading an external script on a Magento CMS page. On the CMS page, I have the following div: <div id="feefo-service-review-widgetId" class="feefo-review-widget-service"> </div> ...
0
votes
1answer
301 views

Magento 2 css problem on fronted and backend

I have the following issue: I copied a project from a server to another. On the original server, everything works fine, but on the new server i don't have any css or js included in my project. I ...
0
votes
1answer
269 views

Magento2 Add custom form in order view but url don't correct

I have a problem when add a custom tabs in order view. In new tabs, I have html form: <form action="<?php echo $block->getUrl('giftvoucheradmin/giftvoucher/addcodetoorder') ?>" method="...
0
votes
1answer
732 views

Magento 2 EE Checkout Page not working (JS error)

I am facing an issue of knockout JS file on my site bixlercollegiate.com. My products are being added, but when I click on checkout, the page becomes blank. When I checked my console on Chrome, the ...