[Solved] Displaying selected dropdown option [closed]


This is a very simple task and you shouldn’t need php or jquery =)

Here’s a quick solution that may work for you:

HTML:

<select>
    <option value="foo">foo</option>
    <option value="bar">bar</option>
</select>    

<div></div>

JS:

var select = document.querySelector("select");
var div = document.querySelector("div");

select.onchange = function(e){
    alert(this.value);
    div.innerText = this.value;
};

Example

4

solved Displaying selected dropdown option [closed]