Want to hone in on my javascript. I want text from select-option dropdown sent to an input. ive found a way to do it.. but my question is- is there a shorter way (in vanilla javascript)?
<select id="gren" onChange="return func1(this)"><option>1</option><option>2</option>
<option>3</option><option>4</option></select>
<input style="text" id="testing">
with
<script>
function func1(select){
var rr = document.getElementById("gren");
var jest = rr.options[rr.selectedIndex].text;
document.getElementById("testing").value = jest; }
</script>
i was thinking something along the lines of:
function func1(select){document.getElementById("testing").value =
this.options[select.selectedIndex].innerHTML;}
but it's not working.. why?
innherHTML=innerHTML. And what is not working? Errors in console?