I have 2 input in my form and I want it like this:
The value of the first input must be the value of the second input.
HTML
<input type="text" id="input1" onKeyUp="getVal()" name="" value="" />
<input type="text" id="input2" name="" value="" />
JAVASCRIPT
<script language="javascript" type="text/javascript">
function getVal(){
document.getElementById('input2').value = document.getElementById('input1').value;
}
</script>
My current code is not working. Can somebody help?
languageandtypeattributes on thescripttag are superfluous.input2on keypup ofinput1.