Linked Questions

4
votes
2answers
7k views

How to include custom JS files in magento 2 custom module

I am well aware of a RequireJS feature of Magento 2. I used it quite well for some JS scripts. require(['jquery', 'ajaxform', ''], function (jQuery) { // JS code }); But now I have a ...
1
vote
4answers
1k views

Add inline javascript to head - magento2

I am struggling to load a script tag on my Magento website. I am trying to add this to the head by adding the below code. I have tried to add this to the default.xml and default_head_blocks.xml &...
3
votes
1answer
3k views

How do add css, js in customview.phtml in view magento2?

I have custom view.phtml. I Want add my.css and my.js in <head></head> 2 file in app\code\Test\New\view\frontend\web\css. How do it?
0
votes
1answer
2k views

Magento 2: How to load the js file in the xml file?

Magento Version: 2.0.0 There have some javascript files should be loaded into the template. How to load them such as importing the css file in tag?
1
vote
2answers
999 views

Magento 2 FancyBox Implementation for youtube videos

Am implementing fancybox in magento 2, which has been implemented in magento 1 but in M2.2x shows a require js implementation and I have done that so but still the issue persist. NOTE : The issue ...
0
votes
3answers
756 views

java script 404 error in custom module

I created one module and i want to add js file to that module but in DOM i am getting "404 not found" my file are My\Helloworld\view\frontend\requirejs-config.js var config = { map: { '*':...
0
votes
1answer
994 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/...
2
votes
2answers
348 views

How to include external JS in adminhtml using requirejs-config.js

I try to include external JS (fabric.js) in my custom module. I try so many different way but still not getting success. i don't understand what i missing below is my code. Add external JS (fabric....
2
votes
2answers
204 views

JavaScript in Magento 2

How can I enable and use a custom JavaScript file in Magento 2? I have a theme.js file located at app/design/frontend/<Vendor>/<theme>/web/js and it depends on jQuery. Now I know there ...
1
vote
0answers
46 views

Magento2 add a custom javascript file to admin pages [duplicate]

How can we add a custom script to administration pages in Magento2? How to load custom module js file in magento 2? Seems to work well for the frontend pages. Is it possible to do the same for admin ...