javascript - Updating input value [HTML/JS] -
i have got problem updating values in input filed [html]. possible update them on change? tried way (i used code found on site):
<input type="text" id='user' value='user' onchange="updateinput(this.value)"><br> <script> var cc2 = document.getelementbyid("user").value; function updateinput(ish){ document.getelementbyid("user").value = ish; } </script> <a href="#" onclick="alert(cc2)">test</a>
after pressing "test" link still receiving alert value: "user" no matter put in input.
please update updateinput following code
function updateinput(ish){ cc2=ish; }
this assign value of input cc2 var. on each change in input make cc2 holds latest value.
Comments
Post a Comment