jeudi 30 janvier 2020

issue with standard checkbox and image

I'm really scratching my head on why I am not seeing the image appear when I click on the checkbox. I get no errors with Inspect Tools. Does anyone see something I am missing? Thank you.

<!DOCTYPE html>
<html lang="en" dir="ltr">
   <head>
    <meta charset="utf-8">
    <title></title>
    <style>
        #your_img {
       display: none;
        }

    </style>
    <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>

    <script type="text/javascript">
        $('#show_image').on("click", function() {
          if ($('#your_img').is(':hidden')) {
            $('#your_img').show();
          } else {
            $('#your_img').hide();
          }
        });
    </script>

    </head>
    <input type="checkbox" id="show_image">Show Image</input>
    <div id="your_img">
    <img src="https://saltwx.com/images/chloro/chloro_bar.png" alt="A image" style="height: 
    485px;width:71px">
    </div>
    <body>

</body>
</html>



Aucun commentaire:

Enregistrer un commentaire