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.

Filter by
Sorted by
Tagged with
8
votes
3answers
7k views

magento2 check if customer is logged in or not in knockout template

How do I check if customer is logged in or not in knockout template? my template <!-- ko if: customer().firstname --> <!-- /ko --> my js define( [ 'ko', 'jquery', ...
2
votes
2answers
1k views

Auto Select colour Swatch when configurable product page loads

I have a configurable product with one colour and different sizes, both these are set as required fields. I've set the colour attribute as not required, but then it wont show up when I create a ...
0
votes
0answers
8 views

Magento_Catalog Custom Gallery customization event

What event do I have to listen for in Javascript to detect that the user has changed the customization in a customizable product? I am working on a custom gallery for my product page, but i am ...
0
votes
0answers
13 views

Magento2: Div is appearing like a flash

I am working on Magento2.2.4. I know this error occurred on the Magento website but it's with a CSS and Js. So that I am posting here. I have two divs on my static block one div is for right side ...
1
vote
1answer
661 views

Magento 2: access quote via javascript

I have a piece of javascript that acts upon the reloadPrice function. It inserts a block of html into the dom to add a corresponding sample product (cloth sample for sofas). This works fine so far. ...
0
votes
0answers
4 views

How to disable magento scrol validation on customer registraion foam?

I have comment the code if (firstActive.length) { $('body').stop().animate({ scrollTop: firstActive.offset().top - windowHeight / 2 }); ...
0
votes
1answer
953 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
0answers
10 views

I have added a js files in pub/media/custom.js is not updating on frontend in magento 2

I have added JS file in pub/media folder and put permission of 777. and given link in content->design->configuration-website <script type="text/javascript" src="https://#/pub/media/custom.js">&...
0
votes
1answer
816 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 ...
3
votes
1answer
665 views

Defer JS / CSS Magento 2 via layout files?

After reading a lot of devdocs, I can see there is a case for deferring in CSS and JS in the manual https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-types.html#layout-types-...
0
votes
1answer
14 views

jquery in how to get the children without tag id using?

j query in how to get the children without tag id using ? i have using table structure to get the children but last children not getting. I have try this Code $(document).ajaxComplete(function (...
0
votes
0answers
8 views

Uncaught TypeError: target.extend is not a function

I am having this issue with disposable-customer-data-mixin.js In a module for Gdpr Cookie for magento 2.3.4 Code is: define([ 'jquery', 'mymodule_GdprCookie/js/action/cookie-decliner' ],...
0
votes
0answers
12 views

Update Shipping Rates Panel

we have the problem, we need to update the shipping rates uppon change of the delivery address. Is there a generic code example that we can include and where we only need to change the "html ...
0
votes
1answer
685 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:...
7
votes
4answers
2k views

How to override particular function of javascript in Magento2

I need to override the particular function (for example : accountFieldsBind) of vendor/magento/module-sales/view/adminhtml/web/order/create/scripts.js
0
votes
1answer
23 views

Magento 2 : Calling a JS function from another JS file?

This Accessing a JS function from another JS file solution not mapped on my problem ,Please give me direction that how can i call getPureValue: function () from tax.js into some where in minicart.js ...
1
vote
1answer
144 views

Magento 2 - How to add Popup on Custom Button in Order View Page and pass information to Controller for further action?

I have added a custom button on the Sales Order View page in Admin using Plugin. When that button clicks it should open a popup with form and when I submit that form then this information should pass ...
0
votes
0answers
20 views

Magento 2.3.4 admin not saving

Good day, From magento ce 2.3.4 admin just in configuration module I can not save or saving button is not working: a) Firefox most of the time not working B) google chrome sometimes not working c) ...
0
votes
0answers
9 views

How to check the number of elements in a block before submitting a form

I have a feedback form and there is a separate block in which I always have a different number of elements, since users always choose a different number of elements. How can I check before sending ...
0
votes
0answers
14 views

How to add url script via requirejs in Magento2?

How to add script by url? For example, I want to add https://code.jquery.com/jquery-3.4.1.min.js using requirejs.
0
votes
1answer
15 views

Magento 2.3 Javascript widget get defaultqty

I want to extend a js widget that applies plus minus buttons. Is there a way to get the defaultqty of a product inside the widget? ;(function ($, window, document, undefined) { $.widget("infortis....
0
votes
3answers
671 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
12 views

Add Increment and Decrement Button After Clicking Add To Cart on Home Page Products

I would like to call an event where the add to cart button is clicked and switches to an increment and decrement button. I cannot find the file which I can edit to do this. I'm not using any modules. ...
0
votes
0answers
16 views

Checkout Page throws Javascript Errors and Hangs

Working on a 1.8.1 > 2.3.4 Magento migration, but I've got checkout pages hanging, and javascript errors of all kinds - but weirdly they clear and tend to work after a couple of refreshes. Can anyone ...
8
votes
5answers
11k views

Magento 2: How to use Cookie?

How can we use cookie in magento 2 to store data.. i'm trying to store data in cookie, on vendor/magento/module-checkout/view/frontend/web/js/model/resource-url-manager.js to store selected ...
2
votes
4answers
2k views

Magento 2: target=“_blank” in UI Listing Action Links

In Magento 2, you can create "Action" links for your UI grid. Magento itself does this on the CMS Listing Grid here #File: vendor/magento/module-cms/Ui/Component/Listing/Column/PageActions.php //... ...
0
votes
0answers
14 views

Magento 2: How to explore a javascript object in j.js file?

The whole object comes from this.cart variable, i want to get item id from this object how can we access it?
3
votes
10answers
6k views

Magento 2.1.3 static content issue

I have installed Magento 2.1.3 , After that I reload the page, css and js are not loading so, I remove the pub/static content. Then regenerate the static content, after that I checked css url path ...
1
vote
1answer
22 views

How to define data to show imageUploader UI element?

Today I trying to create new attribute in product_form.xml on M2 admin. This is code I add my field: <field name="xx" formElement="imageUploader"> <settings> <label ...
0
votes
1answer
658 views

Javascript translation not working

I have override the register template in my custom theme. In this form use the validation to validate my fields but the translation of the error messages aren't showed. I declare the function where I ...
0
votes
1answer
798 views

GridJsObject is not defined when add grid seriallize inside Grid UI

I have face with this error while creat grid seriallize render data inside Grid parent. It build in by Grid UI Component. I dont use old way like magento 1. When click on edit tab to trigger ajax ...
0
votes
0answers
72 views

Magento 2.3 - static-content (JS assets ) give 404 some times on production

I have Magento CE 2.3 on production mode the my store running OK but some times some JS & jQuery gives 404 and the website request in-existing assets from pub/static which causes the whole ...
1
vote
1answer
44 views

Angular with Magento2

I want to use Angular for a feature in Magento2 E-commerce website. For Ex : - I want to create a page(MoodBoard) where customer can create a look using drag drop. I have created a new module for ...
1
vote
1answer
87 views

Add custom javascript in afterRender in Magento 2 with knockout

I`m trying to load a custom script after a custom-template for minicart items is rendered. I created a javascript file vendor\module\view\frontend\web\js\test.js: define('jquery', function($) { ...
0
votes
1answer
25 views

After upgrade to Magento 2.3 - js error in arrays.js in cart and checkout

I am updating an e-commerce with Magento, from version 2.1.18 to version 2.3.4 (I have verified that it also happens by updating to version 2.2.11). Everything went well, but when I add a product to ...
0
votes
1answer
999 views

Linking on button and open custom tab

Need to open custom tab on product view, from link. Magento 1.9.2.4 Custom theme. My tab, which is added just in one category by Custom Design <reference name="product.info.tabs"> <...
2
votes
1answer
893 views

magento 2 spConfig access

how can i access the spConfig variable in a custom function on product view page. <script type="text/x-magento-init"> { "#product_addtocart_form": { "...
2
votes
2answers
39 views

Why is the loading of scripts via RequireJS incredibly slow when they are not cached?

First of all, this is not a question about general Magento 2 performance. I'm already aware of how to speed up Magento 2, in general. My question is specifically about RequireJS and the assets served ...
0
votes
1answer
661 views

Product Out of Stock Subscription in not working in product listing page in magento

I'm using Business King Product Out of Stock Subscription (Link here) to develop product out of stock alert subscription. Its working fine in product details page but it s not working on product ...
0
votes
2answers
39 views

How to add Jquery code snippet in the HTML editor for footer_cms_content

When I place this code :- $(".social-icons").after('<span id="siteseal" style="style="cursor: hand;"></span>'); $.getScript("https://seal.godaddy.com/getSeal?sealID=...
2
votes
1answer
1k views

Remove disable button opacity from search form Magento 2

I've create a new theme based on Blank theme. The search button is transparent when there is no text in the input. How can I remove that transparency? <div class="control"> ...
13
votes
2answers
3k views

Magento 2 console notice - Fallback to JQueryUI Compat activated

Using Magento 2.3.3 seeing the below notice in our browser console. Fallback to JQueryUI Compat activated. Your store is missing a dependency for a jQueryUI widget. Identifying and ...
2
votes
1answer
678 views

Update price without refresh the page

I am working on magento2 customization calculation functionality. In this i have width and gather two field is there in text field I have to calculation with product price eg. pricewidthgather like ...
0
votes
0answers
22 views

How to add 3 templates to custom tabs

I have 3 blocks that are in the cms block and displayed on the cms page. How to place each block in a separate custom tab Tabs stretched to full page 3 templates: app/code/Qqq/Wwwww/view/frontend/...
0
votes
0answers
12 views

How to trigger an event that selects all the select attribute entries with the same value

magento 1.9 I want to do a function (maybe it is possible with js, but I'm not good at it yet) that after a customer selects an entry - IN THE FIRST MOMENT - in the select field "UNIDADE" all the ...
1
vote
1answer
946 views

Magento 2: Adding external CSS and JS to only one content page, and use jquery functions inside the content

I am trying to add some dynamic function to one content page of a Magento 2 site, but didn't manage to do it. Here is what I thought: 1) Adding the external javascript files at the "Layout Update XML"...
0
votes
1answer
872 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
0answers
20 views

Product page Image Gallery Loading Issue

I'm getting images of product and using custom slider to load the product images in product details page, The product is loading normally but sometimes when we refresh the page, Images wont showup. ...
0
votes
0answers
8 views

How to load a JS script together with UI component in magento?

I have a JS file applied to a field dropdown on a form. As I understand it, the Ui component does not render at once, but in parts, so when the script is executed on page loading, the faithful has not ...
0
votes
0answers
11 views

Magento 1.9: JS File in browser does not change

I'm using extension Cm_RedisSession to enable Redis, when i change a js file in media/js folder, and when I reload the browser it still didn't change, i already did these: Delete var/cache , var/...

1
2 3 4 5
40