我有一个文本输入。当页面加载时,一个值被填充到其中。如果用户更改了文本框中的任何内容,那么我希望得到更改后的值(新值)和旧值。但是调用 ELEMENT.value
只返回已更改的/新的值。
我如何得到旧值?
这是我的代码:
<head>
<script type="text/javascript">
function onChangeTest(changeVal) {
alert("Value is " + changeVal.value);
}
</script>
</head>
<body>
<form>
<div>
<input type="text" id="test" value ="ABS" onchange="onChangeTest(this)">
</div>
</form>
</body>