Title: Java script in AMP
Last modified: March 12, 2021

---

# Java script in AMP

 *  Resolved [enricobt](https://wordpress.org/support/users/enricobt/)
 * (@enricobt)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/java-script-in-amp/)
 * Hi
    I know that javascript are blocked by AMP but I would need to add a code (
   attached below) to activate the MAILUP popup in all articles of my site. The 
   code works fine in the pages, such as in the homepage, because I excluded pages
   in AMP advanced settings (so content pages are not enabled in AMP), but of course,
   it’s blocked in all thousands of articles available in my blog. I definitely 
   want to avoid to exclude content articles from AMP too, because this will penalize
   site visibility and performances.
 * Do you have any suggestions on how to activate this javascript in articles too?
   
   Many thanks in advance for your help
 * Regards
    Enrico —-
 * This is the script that i put in the /bosy section of all pages:
    <script type
   =”text/javascript” id=”src-mltchnl” src=”[https://form-multichannel.emailsp.com/forms/3741/match/4edf9d49-3650-47d5-91de-4774004937ef/140272″></script&gt](https://form-multichannel.emailsp.com/forms/3741/match/4edf9d49-3650-47d5-91de-4774004937ef/140272″></script&gt);
   <div id=”frm-mltchnl”></div>
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjava-script-in-amp%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14173704)
 * Hello [@enricobt](https://wordpress.org/support/users/enricobt/)
 * You can use the [amp-script](https://amp.dev/documentation/components/amp-script/)
   component to add custom javascript on your site.
 * The amp-script copies the component’s children to a virtual DOM. so the code 
   will execute in Worked DOM.
 * As I checked the script you attached is dependent on jquery, Presently, libraries
   like jQuery will not work with amp-script without modification, as they use unsupported
   DOM APIs. You can learn mode about it [here](https://amp.dev/documentation/guides-and-tutorials/develop/custom-javascript/)
 * The script creates a form dynamically and attaches it to the page, it also has
   code for validation and other functionalities, I will recommend checking if you
   can add the form without javascript that is using just PHP code. or using WP 
   hooks.
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14174021)
 * If by popup you mean lightbox then you could use `amp-lightbox` without any custom
   JS.
 * Another possibility is the Newspack Popups plugin: [https://github.com/Automattic/newspack-popups](https://github.com/Automattic/newspack-popups)
 *  Thread Starter [enricobt](https://wordpress.org/support/users/enricobt/)
 * (@enricobt)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14222406)
 * Hi
    thanks for your reply. Actually, the solution suggested by amp-script needs
   some effort on programming and I’m not sure if I have the knowledge to make it.
   The solution with newspack-popups cannot work in my current setup, because it
   requires either the newspack theme or some other plugin, such as Gutemberg, that
   I’m not currently using. Do you know if there is any other plugin that creates
   popup’s in AMP environment? Regards Enrico
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14223553)
 * Hello [@enricobt](https://wordpress.org/support/users/enricobt/)
 * I will suggest using [AMP Enhancer](https://wordpress.org/plugins/amp-enhancer/)
   plugin it has a feature to add Popup on AMP pages.
 * 1. Install plugin normally as you do then goto AMP -> AMP Enhancer -> Click on
   the tab named “Features”
 * 2. Enable Popup feature
 * 3. You can configure popup’s from the settings icons next to the toggle button
   or goto AMP->Popup
 *  Thread Starter [enricobt](https://wordpress.org/support/users/enricobt/)
 * (@enricobt)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14228419)
 * Hi
    I tested this plugin and it seems to be fine. I created an HTML form, without
   Javascript, and it works. The only thing is that is not responsive, as on mobiles
   the popup window goes out of the mobile display. I will try to change CSS and
   see if it can go and fit on mobile screens too. Many thanks again for your support.
   Regards Enrico
 *  Plugin Support [Milind More](https://wordpress.org/support/users/milindmore22/)
 * (@milindmore22)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14238368)
 * Good to know it helped, yup some CSS tweak might be needed as per your site.
 * Feel free to open a new support topic if you need further assistance, also [leave your thoughts](https://wordpress.org/support/plugin/amp/reviews/#new-post)
   on using the AMP plugin, We love to hear your feedback

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Java script in AMP’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [popup](https://wordpress.org/support/topic-tag/popup/)

 * 6 replies
 * 3 participants
 * Last reply from: [Milind More](https://wordpress.org/support/users/milindmore22/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/java-script-in-amp/#post-14238368)
 * Status: resolved