Have html popup appear over main html page - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Have html popup appear over main html page

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 </head> //from   www. j  a v a  2  s  . co m
 <body> 
  <div id="mainPage"> 
   <img src="http://www.java2s.com/style/demo/Google-Chrome.png" width="20%"> 
  </div> 
  <div id="popUp"> 
   <p>Hello! It's a popup div </p> 
  </div> 
  <script type="text/javascript">
  $(function() {
    $('#mainPage img').on('click', function() {
        $('#popUp').show();
    });
  });
  </script>  
 </body>
</html>

Related Tutorials