SHARE
TWEET

Untitled

a guest Jun 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function bindEvent(element, eventName, eventHandler) {
  3.             if (element.addEventListener) {
  4.                 element.addEventListener(eventName, eventHandler, false);
  5.             } else if (element.attachEvent) {
  6.                 element.attachEvent('on' + eventName, eventHandler);
  7.             }
  8.         }
  9.  
  10. var sendMessage = function (msg) {
  11.             // Make sure you are sending a string, and to stringify JSON
  12.             window.parent.postMessage(msg, '*');
  13.         };
  14.  
  15.  
  16. document.querySelectorAll('#email')[0].addEventListener('click', function(event) {
  17. var messageButton = document.querySelectorAll('button.spinBtn')[0];
  18.  
  19.         // Send random message data on every button click
  20.         bindEvent(messageButton, 'click', function (e) {
  21.             var email = document.querySelectorAll('#email')[0].value
  22.             sendMessage('' + email);
  23.         });
  24.        
  25. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top