如何使用 jQuery 或仅使用 Javascript 将按钮重定向到另一个页面 [英] How to make a button redirect to another page using jQuery or just Javascript

查看:21
本文介绍了如何使用 jQuery 或仅使用 Javascript 将按钮重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作原型,我希望搜索按钮链接到示例搜索结果页面.

I am making a prototype and I want the search button to link to a sample search results page.

如何使按钮在使用 jQuery 或普通 JS 单击时重定向到另一个页面.

How do I make a button redirect to another page when it is clicked using jQuery or plain JS.

推荐答案

无脚本:

<form action="where-you-want-to-go"><input type="submit"></form>

更好,因为你只是要去某个地方,向用户展示只是去某个地方"的标准界面:

Better yet, since you are just going somewhere, present the user with the standard interface for "just going somewhere":

<a href="where-you-want-to-go">ta da</a>

尽管上下文听起来像是模拟用户提交表单的正常搜索",在这种情况下,第一个选项是可行的方法.

Although, the context sounds like "Simulate a normal search where the user submits a form", in which case the first option is the way to go.

这篇关于如何使用 jQuery 或仅使用 Javascript 将按钮重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆