我想在jquery对话框的按钮上添加css类。
这是我的代码:
$(document).ready(function(){
$('#messageBox p').html('bla bla bla. Ok?');
$('#messageBox').dialog({
modal : true,buttons: {
'Yes': function() {
doSomething();
$(this).dialog('close');
},'No': function() {
doAnotherThing();
$(this).dialog('close');
}
}
});
});
例如,我想在我的“是”按钮上添加“.red”类。
我怎样才能做到这一点?
谢谢!
解决方法
buttons: [
{
text: "Submit","class": 'submit_class_name',click: function() {
$(this).dialog("close");
}
},{
text: "Cancel",click: function() {
$(this).dialog("close");
}
}
]