title: javascript popup box with onclick event
body: <p>I am looking for the JavaScript code that can assist me in getting something similar to the button onclick event. Please take a look at the code below.</p>
  
  <p>Javascript code</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  function myPopup() {
  
      var overlay = $('&lt;div id="overlay"&gt;&lt;/div&gt;');
      $('.x').click(function() {
          $('.popup').hide();
          overlay.appendTo(document.body).remove();
          return false;
      });
      var obj = document.getElementsByClassName('clickLink');
  
      // alert("name");
      myScript = function() {
          overlay.show();
          overlay.appendTo(document.body);
          $('.popup').show();
          return false;
      };
  
      obj[0].addEventListener("click", myScript);
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML Code</p>
  
  <pre><code>&lt;div class='popup'&gt;
      popup content here
  &lt;/div&gt;
  
  &lt;div id='container'&gt;
      &lt;button class='clickLink'&gt;
          Click Here to See Popup!
      &lt;/button&gt;
      &lt;!-- this is working 5ne i called class in javascript --&gt;
  
      &lt;button type="submit" onclick='myPopup();'&gt;
          Click Here to See Popup!
      &lt;/button&gt;
      &lt;!-- but developers need like onclick event --&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>This popup script is working fine but I need an <strong>onclick</strong> event like button onClick='myfunction()'
  please any one help me Thanks</p>