jQuery UI对话框链接而不是按钮 [英] jQuery UI dialog link instead of button

查看:71
本文介绍了jQuery UI对话框链接而不是按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢添加一个按钮(默认情况下受支持)并链接jQuery UI对话框.如何在jQuery UI对话框中添加链接?就我而言,我喜欢具有保存"按钮和取消"链接.预先感谢.

I like to add a button (which is supported by default) and link jQuery UI dialog. How to add a link in jQuery UI dialog? In my case I like to have Save button and a Cancel link. Thanks in advance.

推荐答案

您将不得不按照所需的样式来设置按钮的样式,但这会注入一个链接并将绑定的点击绑定到您想做的事情上.

You will have to style the button how you want to, but this injects a link and binds the click even to do what you want.

$("#dialog").dialog({
    modal: true,
   open: function(event, ui){
            $('<a />', {
                'class': 'linkClass',
                text: 'Cancel',
                href: '#'
            })
            .appendTo($(".ui-dialog-buttonpane"))
            .click(function(){
                 $(event.target).dialog('close');
            });
    },
    buttons: {
        'Save': function() {
            //save code here.
        }
    }
});​

这篇关于jQuery UI对话框链接而不是按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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