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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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 ...

0
votes
1answer
21 views

Magento 2 : Add custom js to a single CMS page

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 in :/app/design/frontend/TemplateMonster/md/web/js and I want to use that js on ...
0
votes
0answers
6 views

How to make file field required pass when submit even it existed value

Today i have faced issue with form contain field file when trying edit form This field is required. But i found my form can't submit even file have value. It keeps raise error validate "Please select ...
0
votes
0answers
12 views

Payment URL Incorrect

I am currently having an issue with SagePay on my website. I think it's probably something quite simple but it is preventing me from taking payment. When I get to the checkout to enter card details ...
2
votes
0answers
10 views

Overriding\Extending Magento_Sales js files

i need to add my custom function call at the end of function loadArea() which located at Magento_Sales/order/create/scripts.js. I already do this with overriding by requirejs-config.js var config = {...
0
votes
1answer
25 views

Displaying a message when hover on a readonly attribute!

I'm trying to display message on hover over a readonly select in a product page, ( Magento 2.2.4, Php 7) Here's my attempt: CSS: #select_801[readonly]{ background: #eee; pointer-events: none; ...
0
votes
1answer
33 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
3answers
36 views

Magento 2.2.5: How to make javascript code run before phtml code

i'm looking for some solution to make javascript run before phtml code. My work is sends width and height of my screen to controller, and it will send back to phtml file(because we cant check width ...
0
votes
0answers
19 views

Javascript API Post

Im posting to API from http - https I've added this code in web.config <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-...
1
vote
1answer
17 views

Magento 2: Customer data from JS component

I need to get customer status in JS component - authenticated or anonymous. Could I get it using Magento_Customer/js/customer-data and how? define([ 'Magento_Customer/js/customer-data' ], ...
-1
votes
0answers
9 views

If the current time reaches 10 sec how myModal function will be called using if else? [migrated]

<!DOCTYPE html> <html lang=""> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <...
0
votes
1answer
23 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
0answers
18 views

If the video reaches 50% of its video so how myModal function will be called using if else when reaches 50%? [on hold]

<!DOCTYPE html> <html lang=""> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <...
0
votes
0answers
4 views

Swatches options are not selecting/addtocart after JS merge Magento 1.9.3.1

Swatches option are not able to selecting after merge JS from admin. If set disable JS merge than it works fine. Have you face issue like this with configurable products. Let me know if any one know ...
0
votes
1answer
27 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 ...
3
votes
1answer
29 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/...
1
vote
0answers
19 views

Magento 2 : How to Use Custom AJAX Code in Admin Front End

I'm developing a delivery system for handling parcels that are handled the delivery agents. since I'm a open cart developer and new to magento, its hard for me to develop. Kindly tell me how to add ...
2
votes
0answers
24 views

Magento 2.2.5: How to console.log() in js file

I'm trying to debug a js file in magento 2. And i dont know how to do that. I've try console.log('some thing in here'), but doesn't work, i've clear cache as well. Here is my problem: I've 3 checkbox ...
1
vote
0answers
18 views

Building javascript “Order by for same day shipping” countdown timer

I've got an online store in Magento and I want to add a countdown timer so that if a customer orders by 5pm Eastern Standard time their product will ship the same day. I need it to be freely usable in ...
1
vote
2answers
50 views

How to use Javascript to display page messages

Is it possible to use JavaScript to display a page message? I would like to display one when I receive an ajax response on a custom module I'm working on. You can see an example of one of these ...
0
votes
0answers
26 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
0answers
20 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
43 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
2answers
47 views

Javascript function in phtml files

I am using onclick function in my template file, here is my html <div class="input-box"> <input type="checkbox" name="change_password" id="change_password" value="1" onclick="...
0
votes
1answer
20 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
1answer
23 views

How to know if a checkout field is loaded in JS?

I'm working on the checkout in Magento 2 (2.2.5). And I constantly have the issue in JavaScript that I don't know when a field is loaded. So if I need the input of country_id field for function I can'...
4
votes
1answer
49 views

How to add JS library to Magento 2?

I need to add the jsPDF library to my Magento 2 Luma theme, so I can use it on the checkout success page.
0
votes
1answer
25 views

js file not loading in ajax returned phtml file magento2

I am returning phtml file content on ajax call in Magento2 its working fine, In the phtml file I am loading jquery and mine custom js file booking, using below code. A query function running fine, ...
1
vote
0answers
15 views

Error in css and js in child theme in Magento 1

I'm having a problem loading style sheets and scripts. I created a child theme, and I did not add any css or js to it. Even so, the magento looks for them in the son theme instead of the father. I'll ...
0
votes
0answers
21 views

Is it possible to mixin placeOptions method in Magento_Ui/js/form/element/select?

I'm trying to override the parseOptions method with: define(['underscore'], function (_) { 'use strict'; var mixin = { parseOptions: function (nodes, captionValue) { var caption, ...
1
vote
1answer
13 views

I want to fix scrolldown in my vertical dropdown menu when I hover it hides before reaching last elements https://ibb.co/e4OZ3z

I want to fix scroll-down in my vertical drop-down menu when I hover it hides before reaching last elements https://ibb.co/e4OZ3z My website url is: https://www.equipus.com/
1
vote
1answer
16 views

I want a button in a vertical menu to go down smoothly as shown in screenshot https://ibb.co/nO610e

I want all category and close button in a vertical menu to go down and up smoothly as shown https://ibb.co/nO610e https://www.equipus.com/
2
votes
2answers
51 views

Magento2 : How to get base require js baseUrl to get static files?

I am creating a custom module which retrieves the image from Package_Module/images/image.jpg in my javascript code. How to get the require js base URL or Static URL? or do you have any suggestions on ...
0
votes
8answers
90 views

Magento frontend and backend CSS is not working

I have installed Magento 2.2.5 on my server using Cpanel. The problem I am facing is my CSS is not working properly. The Url of my site is http://emcd.tk/. I've looked on so many solutions but didn't ...
3
votes
0answers
67 views

Magento 2 : Javascript Developer Certification reading material [closed]

Magento will soon going to announce Javascript Certification exam for Magento2. After reading in this page: https://u.magento.com/developers I have some questions about this Javascript ...
0
votes
0answers
8 views

Related Product addtocart url 302 http code

I am showing related product in popup with ajax. For this I override `vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml. Change $showCart = true; in case - ...
1
vote
0answers
12 views

Is it advisable to put JS in the footer? Magento 1.9.x

Good evening dear, A query is a good practice to put the JS in the footer in magenta 1.9.x? In Google Speed ​​Test tells me that there are resources that clog the page when loading
0
votes
0answers
27 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
12 views

Listing All Products From Searching Category Name?

Is there a way to list all the products by searching for the category name from setting filters in a URL search? The error I get from RESTClient is: URIError: malformed URI sequence and the error ...
1
vote
1answer
16 views

JavaScript Merge issue in Magento 1.9

I have one issue, I enabled JavaScript merge option in magento backed but iam getting many issues in checkout page. Please see the image. anyone please help. I need javascript merge because i saw ...
1
vote
0answers
31 views

Magento 2: Browser console error on hard refresh

I am facing some weird issue with Magento 2.2.5 version. When I first-time open website, I am getting lots of js errors. (Screenshot attached) After this, when I only press F5 button (normal refresh) ...
0
votes
0answers
30 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 ...
3
votes
1answer
46 views

How to Change the success message in the popup when click add to cart?

How to Change the success message in the popup when click add to cart? https://ibb.co/nigBmy
2
votes
1answer
31 views

Hi, I'm trying to display a normal message if one payment method is selected in Magento 1.9

I'm trying to display a normal message if one payment method is selected in Magento 1.9 can any one help me on that? especially the locations of the files to edit?
1
vote
0answers
11 views

Magento 2: Translation in JavaScript don't work

I try to translate the next line and this don't show changes: if (pending > 0) { $('#wrapper-freeshipping_alert > p').text($.mage.__('You need %1 more for free shipping').replace('%1', ...
0
votes
0answers
6 views

How to defer Magento 2 JS

Could you please help to defer Magento 2 JS files and improve store performance.
0
votes
1answer
26 views

Magento 1.7 custom options not updating price

On a Magento 1.7 website the product option price is not longer updating the main price. I updated the prototype.js file which I though was causing the issue but still no luck. When I inspect the code ...
1
vote
1answer
30 views

customer undefined trying to check if logged in

I'm trying to display a registration pop-up only if a user has never seen it before and it occurred to me it would be wise to also check to make sure they were not already logged in. But when I ...
0
votes
0answers
9 views

How to change options in widget on click?

I have this code in my JS widget with some options $.widget('markdev.accordion', tabs, { options: { active: [0,1,2], multipleCollapsible: true, ...
0
votes
1answer
33 views

How do I add a custom message on magento's checkout page(right below the Country selector) based on the country that user selects to ship the product?

For example: If a user wants to ship to India, I want to show a small message below the country selector and before the shipping method saying that "custom duties and taxes has to be paid by customer"....
0
votes
0answers
19 views

Calendar not showing in customer registration form. in magento 1.9

I am using Magento 1.9. I have enabled Javascript calendar in magento admin, but it is not displayed on customer registration page for Date of Birth field. Instead, its showing 3 input boxes. and i ...