Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change dialog title color in jquery ui?

I have something like this:

$div = $('<div id="error" title="Error">');
$div.append('<p>Hi</p>');

$div.dialog({
    modal: true,
    maxHeight:500,
});

Can i change background color of dialog title somehow like this?:

 $div.dialog({
        modal: true,
        maxHeight:500,
    }).find(".ui-dialog-titlebar").css("background-color","red");
like image 263
milandjukic88 Avatar asked Jan 24 '14 16:01

milandjukic88


People also ask

How to change color in jQuery dialog box?

Scroll down in the "Styles" tab until you find the attribute you care about ( background-color ). You can click on the value and type in a new value to verify that it will have the effect you desire. Your . css file needs to use the same style and be included after this one (see "short answer", above).

What is jQuery ui dialog?

The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default. Syntax: You can use the dialog ()method in two forms: $(selector, context).


1 Answers

Use prev() instead of find() because that element is not inside $div:

$div.dialog({
    modal: true,
    maxHeight:500,
}).prev(".ui-dialog-titlebar").css("background","red");

Also I use background to override all other elements like background-image

Check this http://jsfiddle.net/Ad7nF/

like image 79
DaniP Avatar answered Sep 29 '22 02:09

DaniP