I have the following code sample:
<div id="dlgTest1" style="display: none">
<p>
Lorem ipsum test popup dialog<br />
<br />
Click the OK button to resume activity.
</p>
</div>
<script type="text/javascript">
$(document).ready(function () {
var myTitle =
"<div style='float: left'>LEFT TEXT</div><div style='float: right'>RIGHT TEXT</div>";
$("#dlgTest1").dialog({
title: '', // new jquery-ui-1.10.2 doesn't allow HTML here
autoOpen: false,
minWidth: 500, width: 500,
minHeight: 200, height: 200,
resizable: true,
modal: true,
show: "blind",
hide: "explode",
buttons: {
"OK": function () {
$(this).dialog("close");
}
}
}).siblings('.ui-dialog-titlebar').html(myTitle); // title goes here
$("#dlgTest1").dialog("open").dialog("moveToTop");
});
</script>
This sample code opens a jQuery dialog, which displays text in the title bar on the left side and on the right side, which is achieved by myTitle
, a variable that contains HTML code with two <div>
elements.
In previous versions of jQueryUI (e.g. V1.8.20) I was able to directly assign the title attribute with the content of myTitle
and it worked like a charm. Now I've upgraded to V1.10.2 and noticed that title doesn't interpret HTML any more but shows the <div> ...
in the title instead.
As you can see, I am using the tweak .siblings('.ui-dialog-titlebar').html(myTitle);
to pass through my HTML code, which works basically.
But it has the side effect that it hides the (X) button used to close the dialog (that side effect didn't occur in the older jQUery UI version V1.8.20). I can't go back to the earlier version of jQueryUI because I need controls that depend on the latest version.
Question: How can I avoid that the (X) close button is hidden by the right-aligned text?
Note: The icon is displayed, if I use normal text instead of HTML formatted text, so the reason is not that a style or bitmap is missing.
I have already looked everywhere (beginning with http://jqueryui.com/), searched in Google etc. but found no solution.
Any help is much appreciated.
Update: (Answers to the comments below)
- I am using the ui-lightness css theme without any modifications
- Adding
padding-right:20px
to thestyle
attribute of the right-aligneddiv
doesn't solve the issue.
Final note:
The discussion with you all helped me a lot solving the issue. I have posted the answer which finally worked for me.
Thank you very much to all who have supported me, you guys are really great! Everyone who has posted an answer got a +1 from me.
margin-right
to the outer div which contains the title. – Decorstyle='float: right; padding-right:20px'
. The effect is that the text is shifted to the left, which would be enough space for the icon - but unfortunately it is not shown (and you can also not click on it). – Gillman