In this tutorial we will discuss how to display image onchnage the select option using jquery.
Also Read:
- How to Get Selected Check boxes Values in jQuery
- How to Insert Multiple Data in PHP using Ajax
- How to Insert Data using PHP Ajax
<!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>
0 Comments