I have a form with select tag in it named “cost”. I would like to write a function updateText() that would do the following
- get the value of selected option withing that select tag
- do some math with like add some other number
- copy the result od 2. into input tag named “sum”
<script type="text/javascript">
function updateText() {
}
</script>
<select name="cost" id="cost" onchange="updateText()">
<option>100</option>
<option>200</option>
<option>300</option>
</select>
<input type="text" name="sum" id="sum" />
Please help me with some tips about what to write in updateText().
Thanks in advance.