rihab
rihab

Reputation: 181

POP up triggered by a click

I am trying to open a popup by clicking on a button. Please check my below code and tell me why it isn't working. I am using getreponse popup

http://www.reussirlegmat.com/2499-2/

<!doctype html>
<html lang="en">    
  <head>  
    <meta charset="utf-8">    
  </head>    
  <body>       
    <button id="button" >Show it</button>   
    <script type="text/javascript" src="https://app.getresponse.com/view_webform_v2.js?u=BaAuE&webforms_id=7152504">{    
  "name": "myuniqueform2"       
}       
    </script>      
    <script>        
      var myform = GRWF2.get('myuniqueform2'),   
          element = document.getElementById('button');   
      element.addEventListener("click", function(){          
        myform.show();        
      });       
    </script>     
  </body>    
</html>

Upvotes: 0

Views: 744

Answers (1)

Barmar
Barmar

Reputation: 782181

On your website, something has put <p>...</p> tags around every line of your script.

<p><script type="text/javascript" src="https://app.getresponse.com/view_webform_v2.js?u=BaAuE&#038;webforms_id=7152504">{</p>
<p>"name": "myuniqueform2"   </p>
<p>}   </p>
<p></script>   </p>
<p><script>     </p>
<p>var myform = GRWF2.get('myuniqueform2'),</p>
<p>element = document.getElementById('button');</p>
<p>element.addEventListener("click", function(){       </p>
<p>myform.show();     </p>
<p>});   </p>
<p></script> </p>
<p></body></p>
<p></html></p>

Those are causing parse errors. Get rid of them.

I have no idea how you did this -- I suspect you edited the code with a word processor and then told it to export to HTML.

Upvotes: 1

Related Questions