更新时间:2023-10-25 15:55:22
将逻辑绑定到 $。change()
并从 $。val()
获取当前值,以确定用户应该重定向到哪里。此示例假定一个位置直接存储在值本身中。
Bind the logic to the $.change()
event, and get the current value from $.val()
to determine where the user ought to be redirected to. This example assumes a location is stored directly in the value itself.
$(".mySelect").change(function(e){
window.location = $(this).val();
});