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.

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

Check-out broken after theme installation

I've installed a theme and everything works as intended except the check-out page, it seems like a JS file is missing or something. Any ideas what's going wrong? Magento v2.1.7 Nothing in logs or ...
0
votes
2answers
47 views

Magento 2 : Css and Javascript not loading

I have a big problem with magento, my css and javascript are not loading, I already did: Content deploy; Deleted the static folder but kept the .htacess; but nothing seems to work.
0
votes
1answer
335 views

How to add defer to a custom JS script in magento 2.x

I need to add a custom script in my module and that script requires me to add defer in it. I have added the script in the requirejs-config.js file. But i am cannot see that script working. Although i ...
0
votes
0answers
118 views

Totals - Minicart - JS problem

I have 4 errors in my shop now. After change a plugin and did everything clearing the cache, deploy the static files, we have the error with the totals js, I should say, we bought a template and we ...
0
votes
0answers
39 views

Changing theme results in error - Magento 2

To find the solution of this question :(add to cart not working) Add to cart not working for configurable products on product listing page. Magento - 2 I switched the theme from my custom one to ...
0
votes
1answer
257 views

requirejs-config, requirejs errors

Does anyone know where these errors come from and how to solve them ! Failed to load for element whose source is http://...pub/static/version1521024130/frontend.../fr_FR/text.js I also see this ...
0
votes
1answer
63 views

Custom options not loading after saving the product in admin - Magento 2.1.7

I tried creating few custom options for a product. A field type and dropdown type. After saving the product getting a javascript error in the console as shown in the screenshot data.forEach is not a ...
0
votes
2answers
2k views

Add js in head in magento 1.9

All js script are loaded in footer in magento 1.9. I want them in head. Can Anyone let how to do this ?
0
votes
1answer
507 views

how to add css and js in the footer in magento 2?

Currently, CSS and JS added in head section default_head_blocks.xml. But I want to add in the footer. In which I need to put the css and js?
0
votes
1answer
112 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
637 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
1answer
684 views

Shipping modules does not update rate on zip code changes in guest-checkout page Magento 2 production mode

Preconditions Magento 2.0.4 install Cart page and checkout page Steps to reproduce: 1. Put any product inside your cart 2. Open cart page or checkout page 3. input zipCode to calculate tax for ...
0
votes
1answer
897 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
48 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
38 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
110 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
250 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
65 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
55 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
1answer
452 views

Made category menu fixed or sticky

I tried to made the category menu fixed or sticky in the top. I read this question and it's seems work, but i don't know on which file i should to add the javascript and CSS. So, which file should i ...
0
votes
0answers
43 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
59 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
7k 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
41 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
93 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
1k 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
704 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
46 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
374 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
302 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
276 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
574 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
568 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
247 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
261 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
268 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
1k 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
782 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
182 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
320 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
478 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
531 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
123 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 ...