I basically want to use javascript to have 2 textboxes that depend on each other. For example if I input a number x in textbox1, I want textbox2 to instantly update with x*2. If I input x into textbox2, I want textbox1 to be automatically updated with x/2. These values will always be numbers.
Edit: so here is my html file. Can anyone give me a hint to why it's not working?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="scripts/jquery-1.7.2.js"></script>
<script type="text/javascript">
$("#text1").keyup(function(){
$("#text2").val($(this).val() * 2);
});
$("#text2").keyup(function(){
$("#text1").val($(this).val() / 2);
});
</script>
</head>
<body>
<input type="text" name="text1" size=3 maxlength=6>
<input type="text" name="text2" size=3 maxlength=6>
</body>
</html>