cancel
Showing results for 
Search instead for 
Did you mean: 

Add Custom JS to my custom module frontend

Add Custom JS to my custom module frontend

I have created my custom module in that a particular .phtml file i want to apply my custom JS

please suggest as soon as possible.

1 REPLY 1

Re: Add Custom JS to my custom module frontend

Hi @asd_asd46 

If you want to add js with phtml file then you can consider below code and add with phtml file:

    <script>
        require(['jquery', 'myscript'], function($, myscript) {
         cosole.log("testing");
        });
    </script>

Or you can refer below link :
https://magento.stackexchange.com/questions/301627/magento-2-how-to-include-custom-js-file-in-phtml-...

If issue resolve, please click on 'Kudos' & Accept as Solution!


Problem solved? Click Accept as Solution!