I need to open a popup on click of anchor link. I followed this (How to open popup when <a> tag onClick?) answer but the issue is that i have to add script inside .phtml file.
I want to include the script in .js file and then use it. How can i achieve this?
I have already tried by adding inside Vendor/Theme/web/js/custom.js but then the pop up is not getting displayed.
The second solution in the (How to open popup when <a> tag onClick?) link is not working for me.
Can some guide me towards this?
Best Answer
Please add the following to show popup:
whatever you want to show in popup,
Add below popup script:
You can use Anchor tag instead of span.
clear the cache and check..