$(document).ready(function() {
$( "#addLocation" ).dialog({
modal: true,
height: 820,
width: 550,
buttons: {
"Add Location": function() {
document.forms['mapform'].submitted.value='1';
document.forms["mapform"].submit();
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
});
});
如何在模态对话框中的“添加位置”按钮上实现addClass
功能?
谢谢,
答案 0 :(得分:2)
将按钮设为数组并将按钮设置为对象
buttons: [{
text: "Add Location",
click: function() {
document.forms['mapform'].submitted.value='1';
document.forms["mapform"].submit();
},
class: "myCssClass"}]
答案 1 :(得分:0)
$(this).addClass("myCssClass")
不起作用?
如果没有,让浏览器呈现按钮并添加asswardes css类。
答案 2 :(得分:0)
$("#addLocation").dialog("widget").find(".ui-dialog-buttonset button:eq(0)").addClass("");
您只需要为:eq()
设置正确的索引