Kwasi Denkyira

Kwasi Denkyira

  • 1.9k
  • 129
  • 6k

How to pop up an Image from html as an alert

May 5 2021 7:40 PM
I have an html page with an image src and I want to pop up the image on page first load in mvc layout . I am struggling to get the popup working.  Below is my html code
 
  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.     <title>CUI Page</title>  
  5.     <meta charset="utf-8" />  
  6.     <script src="/Scripts/jquery-1.10.2.min.js"></script>  
  7.     <link href="/Content/bootstrap.min.css" rel="stylesheet" />  
  8.     <script src="/Scripts/bootstrap.min.js"></script>  
  9. </head>  
  10. <body>  
  11.    
  12.     <div class="container">  
  13.         <div class="col-md-12" id="hide">  
  14.             <img src="/Content/Images/warning.png" style="margin-left: auto; margin-right: auto; display: block;" alt="" />  
  15.   
  16.             <button autofocus id="myButton" type="button" style="margin-left: auto; margin-right: auto; display: block;">OK</button>  
  17.         </div>  
  18.     </div>  
  19.        
  20. </body>  
  21. </html>  
  22. <script>  
  23.     $("#myButton").on('click', function () {   
  24.         $("#hide").hide();  
  25. </script>  
 
 
 

Answers (3)