How to display image onChnage the select option using jQuery


0

In this tutorial we will discuss how to display image onchnage the select option using jquery.

Also Read:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>How to display image when click the select option using jQuery </title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
        function setCar() {
            var img = document.getElementById("image");
            img.src = this.value;
            return false;
        }
        document.getElementById("CarList").onchange = setCar;
    </script>
</head>
<body>
    <img id="image" src="Null_Image.png" />
    <select id="CarList">
<option value="Null_Image.png">No Car</option>
<option value="http://mebe.co/volvo">Volvo</option>
</select>
</body>
</html>


Like it? Share with your friends!

0
Developer

0 Comments