jQuery UI-更改按钮类 [英] JQuery UI - Change the button class

查看:61
本文介绍了jQuery UI-更改按钮类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释如何为标准JQuery UI对话框小部件更改按钮上的CSS类吗? 我的addClass()调用无法正常工作.

Can someone explain how I can change the CSS class on the button, for the standard JQuery UI dialog widget? My addClass() call is not working.

$("#dialog-message").dialog({
    modal: true,
    buttons: {
        Ok: function () {
            $(this).dialog("close");
            $(this).addClass("btn");
        }
    }
});

推荐答案

要回答您要问的问题,有人可以解释如何更改标准JQuery的CSS类 . UI对话框小部件",有几种方法.这是最完备的. 请注意,'class'用单引号引起来.这是因为IE中断时会中断.

To answer what you meant to ask, "Can someone explain how I can change the CSS class of a button for the standard JQuery UI dialog widget" there are a few ways. This is the most self-contained. Note that 'class' is encapsulated with single quotes. This is because IE breaks if it's not.

$("#dialog-message").dialog({
    modal: true,
    buttons:[
        {
            text: 'Ok', 
            'class': 'btn',
            click: function(){
                $(this).dialog("close");
            }
        },
        {
            text: 'Cancel', 
            'class': 'cancel',
            click: function(){
                $(this).dialog("close");
            }
        },
    ]
});

这篇关于jQuery UI-更改按钮类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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