You are calling the dialog function (.dialog) in line there. That will return a jQuery wrapped object
The title of the dialog is exactly what you've specified in the arguments dialog("option", "
title")!
Here is some HTML generated by the .dialog function
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
Dialog Title
<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button">
close</a>
</div>
So really, what you want to do is get the
child of the ui-dialog-titlebar class element, which should read like this
$('.ui-dialog-titlebar').mouseup(function () {
alert($(this).children('#ui-dialog-title-dialog').text());
});
The order of events is important in jQuery. We're trying to attach an event handler to an element that is dynamically created by the .dialog function. Therefore, we can only attach the handler after the dynamic HTML has been generated.
e.g.
$("#dialog").dialog();
$('.ui-dialog-titlebar').mouseup(function () {
alert($(this).children('#ui-dialog-title-dialog').text());
});