gpt4 book ai didi

javascript - 从选择下拉列表中选择项目时自动重定向

转载 作者:技术小花猫 更新时间:2023-10-29 12:35:29 25 4
gpt4 key购买 nike

此页面按照我希望的方式执行:http://www.web-source.net/javascript_redirect_box.htm

但我想找到一种使用 jQuery 的更好方法,谁能告诉我一个使用 jQuery 来完成此任务的好脚本?

最佳答案

您不需要为此预先打包的脚本,只需几行代码。

// get your select element and listen for a change event on it
$('#selectEl').change(function() {
// set the window's location property to the value of the option the user has selected
window.location = $(this).val();
});

关于javascript - 从选择下拉列表中选择项目时自动重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/580281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com