jquery - 如何为 jquery 对话框应用背景颜色 css

标签 jquery

我正在运行时形成一些弹出的羊肚菌,如下所示,但我想应用背景颜色CSS如何应用它?

$("<div></div>")
                .addClass("dialog1")
                .attr("id", $(this).attr("id"))
                .appendTo("body")
               // .addCss("background-color","red")
                .dialog({
                    title: $(this).attr("data-dialog-title"),
                    close: function () { $(this).remove() },
                    width: $(this).attr("data-dialog-width"),
                    modal: true,
                    position: 'center',
                    resizable: $(this).attr("data-dialog-resizable")
                }).load(url);

                $(".close").live("click", function (e) {
                    e.preventDefault();
                    // $(this).dialog('destroy').remove();
                    $(this).closest(".dialog1").dialog("close");
                });

最佳答案

您可以使用css()而不是addCss:

.css("background-color","red")

以及 live() 已弃用,您应该使用 on()相反

关于jquery - 如何为 jquery 对话框应用背景颜色 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16437132/

相关文章:

Javascript/jquery 在两个 TreeView 列表之间拖放

jquery - 使用 jquery 水平滑动带有控件的 ul li 列表

javascript - 使用 jquery 创建自定义方形网格

php - 非常简单的jquery AJAX post问题

jquery - 从 Google Charts 解析 Json

javascript - 删除所有其他逗号并用方括号括起来

jQueryUI 自动完成 : how to use 'first-of-type' and 'last-of-type' with #ui-active-menuitem?

javascript - jqGrid - 复选框编辑无法编辑选定的行

php - 调整图像大小而不实际更改文件夹中的图像

jquery - 制作具有固定标题和固定侧边栏的可滚动表格