Title: Custom JavaScript
Last modified: January 26, 2020

---

# Custom JavaScript

 *  Resolved [dimabobrovski](https://wordpress.org/support/users/dimabobrovski/)
 * (@dimabobrovski)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-javascript-3/)
 * I trying connect custom java script to amp page, i did it by example and nothing
   not working.
 * in the head i put :
 * <script async custom-element=”amp-script” src=”[https://cdn.ampproject.org/v0/amp-script-0.1.js”></script&gt](https://cdn.ampproject.org/v0/amp-script-0.1.js”></script&gt);
 * in body:
 * <amp-script src=”<?php echo get_template_directory_uri(); ?>/assets/js/modules/
   script.js”>
    <div id=”test”></div> </amp-script>
 * java script is simple alert some text.
 * why it not working ?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-javascript-3/#post-12366542)
 * The `amp-script` component is not a simple replacement of `script`. There are
   restrictions on what the included script can do in order to not negatively impact
   performance. Make sure you review all of the documentation for usage and restrictions
   at [https://amp.dev/documentation/components/amp-script/](https://amp.dev/documentation/components/amp-script/)
 * You can see from the compatibility table that alert() is not supported: [https://github.com/ampproject/worker-dom/blob/master/web_compat_table.md](https://github.com/ampproject/worker-dom/blob/master/web_compat_table.md)
 * Make sure you have your DevTools console open to see any error messages raised.

Viewing 1 replies (of 1 total)

The topic ‘Custom JavaScript’ 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

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

 * 1 reply
 * 2 participants
 * Last reply from: [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/custom-javascript-3/#post-12366542)
 * Status: resolved