1

I have a web page with a clickable button that should display an image after clicking. It works fine when using fiddle but when I took it offline it doesn't display any image.

This is the code below.

**

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script src="jquery-1.8.3.min.js"></script>
    
    <script>
        $('#btn').on('click', function() {
    $('#img').attr('src', $('#url').val());
    });
    </script>


    <style>
        .center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 30%;
}
    </style>
    <title>Document</title>
</head>
<body>
    <br><br>
<img src="" id="img" class="center">

<br><br>

Type in a URL to an image below :<br><br>

<input type="text" id="url"/><input type="button" id="btn" value="show image" />

</body>
</html>

**

0 Answers0