10 Replies Latest reply: Mar 19, 2013 6:42 AM by osgood_ RSS

    PHP - show image next to <option>

    osgood_ MVP

      Is it possible via javascript/jQuery to select an image option (see below) and then have the image associated with the <option> show next to the <select> tag?

       

      <select name="images" id="images">

      <option>Select Image</option>

      <option value="one.jpg">one.jpg</option>

      <option value="two.jpg">two.jpg</option>

      <option value="three.jpg">three.jpg</option>

      <option value="four.jpg">four.jpg</option>

      <option value="five".jpg>five.jpg</option>

      </select>

       

      <img src="http://www.DomainName/imageOptions/nameOfImage.jpg" width="200" height="200" alt="" />

       

      I could probably do it with php by getting the option value but that means I'd have to submit the page first, which I'm trying to avoid. javascipt might be able to do this onclick?

       

      Cheers

       

      Os