<html xmlns="">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var mysel = $("#mysel");
mysel.data("last", mysel.val()).change(function () {
var oldvalue = mysel.data("last"); //这次改变之前的值
mysel.data("last", mysel.val()); //每次改变都附加上去,以便下次变化时获取 改变之前获取并保存
var newvalue = mysel.val(); //当前选中值
alert("改变前的值:"+oldvalue+",改变后的值:"+newvalue);
});
});
</script>
</head>
<body>
<select id="mysel">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</body>
</html>
js获取select变更之前的值
于 2022-03-21 20:04:25 首次发布