Javascript API

  1. Home
  2. Docs
  3. Javascript API
  4. clickEvent()

clickEvent()

Once the Prompty snippet has been added to your website’s pages, you can trigger a notification opt-in from any HTML element using the Prompty.clickEvent() function. This allows you to create any sort of callout that you can imagine.

For example, to create a subscribe button:

<button onclick="Prompty.clickEvent();">Notify me!</button>

Or a link:

<a href="#" onclick="Prompty.clickEvent(); return false;">Subscribe to notifications</a>

These elements can also be styled using CSS, just like regular HTML:

<button class="notifyme" onclick="Prompty.clickEvent();">Subscribe</button>

Or use jQuery selectors to make any element on your page a button:

<script>
jQuery(document).ready(function() {
  jQuery(".notifyme").click(function() {
    Prompty.clickEvent();
  })
});
</script>

Was this article helpful to you? Yes No

How can we help?