如何为 jquery UI 对话框添加自定义属性

Nat*_*san 4 jquery-ui jquery-dialog

我想向 jquery 对话框添加一个额外的属性。

$(".pipeline-dialog").dialog({
    dialogClass: "dialog_status,
    autoOpen: false
});
Run Code Online (Sandbox Code Playgroud)

如何在创建对话框时添加“dialog-status”等属性。

有什么方法可以做到这一点?

vkl*_*idu 5

尝试这个:

$(".pipeline-dialog").dialog({
    //initial value for custom attribute
    customAttribute: "value"
});

//get value
var customAttrValue = $(".pipeline-dialog").dialog("option", "customAttribute");

//set new value
$(".pipeline-dialog").dialog("option", "customAttribute", "new value");
Run Code Online (Sandbox Code Playgroud)