无法让我的Jquery按钮转到链接 [英] Can't get my Jquery button to go to links

查看:77
本文介绍了无法让我的Jquery按钮转到链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jquery来为我的网站设置一些按钮样式,除了按钮什么都不做的事实外,它看起来很棒.这是我设置按钮的方式;

I am using Jquery to style some buttons for my website and it looks great except for the fact the the buttons do nothing. Here's how I have the buttons setup;

JS

$(function() {
    $( "input[type=submit], a, button" )
    .button()
    .click(function( event ) {
        event.preventDefault();
    });
});

HTML

<button><li><a href="../home.html">HOME</a></li></button>
<button><li><a href="../commercial.html">COMMERCIAL</a></li></button>
<button><li><a href="../residential.html">RESIDENTIAL</a></li></button>

推荐答案

    $(function() {

    $( "input[type=submit], a, button" )
    .button()
    .click(function( event ) {
var urlink = $(this).attr('href');   
    window.location = $urlink;   
    });
    });

这篇关于无法让我的Jquery按钮转到链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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