In this post I am going to explain how to create and call modal popup widget in Magento 2.

First, you need to create a “mymodal.js” file at below path.

Path: app/code/<vendor>/<module>/view/frontend/web/js/mymodal.js

 

 

After creating js file, create a “requirejs-config.js” at file below path and add/call js in it.

Path: app/code/<vendor>/<module>/view/frontend/requirejs-config.js

 

Now, add below code in your phtml file.

 

 

Thats it. Enjoy Magento 2!!