Magento 2 How to add core or custom JavaScript file


There are so many ways we can include javascript in Magento 2.

Example: 1

   require(['jquery', 'jquery/ui'], function($){ 
     //your js code here  
   });


Example: 2
 
   require(['jquery'],function($){
     $(window).load(function() {
         alert('jquery working');
     });
   });
 

No comments:

Post a Comment