user3009138 user3009138 - 5 months ago 5
HTML Question

HTML select value assign to html field

I need a little help (i can`t figure out). How i can put a selected HTMl field value to another HTMl field when i select some value from the first field.

Explanation of the problem in picutre

Best regards
Trajce Gogov

Answer

One Javascript solution could be:

<script type="text/javascript">
var dropdownList = document.getElementById("dropdownList");
var dropdownListValue = document.getElementById("dropdownListValue");

if(dropdownList != null) {
    dropdownList.innerHTML = dropdownListValue;
}
</script>

Not proof-tested so not entirely sure if working. However, make sure you put it at the bottom of your page to allow everything load up and run BEFORE the Javascript.

Comments