<分区>
<分区>
我有这个页面
在此页面中,您会找到一个名为“获取报价”的按钮。当我单击此按钮时,我想转到 google.com。
为此,我尝试了以下代码。
jQuery(function($) {
$(".wpcf7-form-control.wpcf7-submit").click(function() {
window.location = "www.google.com/index.php?id=";
});
});
不幸的是,当有人点击按钮时,链接会出现这种形式。
http://dgprint.dg-site.com/www.google.com/?id=
谁能告诉我为什么不工作?该站点是使用 Wordpress 插件制作的,并使用了“Contact form 7”
提前致谢!
编辑:
<div class="contact-frm">
<div class="right">
<?php echo do_shortcode('[contact-form-7 id="9" title="get a quote"]'); ?>
</div>
</div>
编辑2:
<p><input type="submit" value="get a quote" class="wpcf7-form-control wpcf7-submit"><img class="ajax-loader" src="http://dgprint.dg-site.com/wp-content/plugins/contact-form-7/images/ajax-loader.gif" alt="Sending ..." draggable="false" style="visibility: hidden;"></p>
最佳答案
这样使用:
jQuery(document).ready(function($) {
$('.wpcf7-form-control .wpcf7-submit').click(function() {
window.location = "http://www.google.com/index.php?id=" + $(this).attr("id");
// ------------------------------------------------------------^^^^
});
});
关于html - 使用 JQuery 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30844416/