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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -