JQuery onchange/onfocus select box to display an image


I need some help finding a jQuery plugin which will allow me to display an image preview from a select list of images – onfocus/onchange..


<select name="image" id="image" class="inputbox" size="1">
   <option value=""> - Select Image - </option>
   <option value="image1.jpg">image1.jpg</option>
   <option value="image2.jpg">image2.jpg</option>
   <option value="image3.jpg">image3.jpg</option>

<div id="imagePreview">
   displays image here

Has anyone come across something like this? I've tried searching for it to no avail..

Thank you!

Best Solution

I'm not sure you need a plugin to deal with this:

$(document).ready(function() {
    $("#image").change(function() {
        var src = $(this).val();

        $("#imagePreview").html(src ? "<img src='" + src + "'>" : "");