Thursday, February 26, 2015

Change Image on Select Dropdown HTML+JS

GOAL:  Switch out an image on a webpage based off of a select dropdown option. [HTML + JavaScript]

<select onchange="$('#imageToSwap').attr('src', this.options[this.selectedIndex].value);">
    <option value="           49940.jpg" selected>Facebook</option>
    <option value=" 
    <option value="     logo-of-photo-camera_318-64651.jpg">Instagram</option>

<img id="imageToSwap" class="profile" src="">

See the Pen Change Image on Select Dropdown by Josh Wentz (@joshwentz) on CodePen.

1 comment:

  1. Ever wanted to get free Instagram Likes?
    Did you know that you can get them AUTOMATICALLY AND ABSOLUTELY FREE by using Like 4 Like?