Update input field event onchange?
$A = array(A,B,C,D);
<select name="A" id="A" onchange="change_val()">
<?php
foreach($A as $key=>$val){?>
<option value="<?php echo $key?><?php echo $val?"></option>
<?php }?>
</select>
<input name="seleted_value" id="seleted_value" value="Hello first time" >
I want to write a onchange method change_val() that do this task:
if select A ( by default ) show value ‘Hello first time’ into input field seleted_value
else show value have selected into input field seleted_value AND Disable this input field for read only.
Anybody could guide me how to do this?
if selected= A =>show 'Hello first time'
if selected= B =>show 'B'
if selected= C =>show 'C'
if selected= D =>show 'D'
Sure:
jsFiddle example