dialog Focus on click / selected - is this right ?

dialog Focus on click / selected - is this right ?


When there are multiple dialogs on a page, I was trying to get the one
I clicked on to be in focus to save me from having to move the other
open ones away.
So far what I have come up with is to change this item...
var uiDialog = uiDialogContainer.parent()
.addClass('ui-dialog')
.css({position: 'absolute', width: options.width, height:
options.height});
to the following...
var uiDialog = uiDialogContainer.parent()
.addClass('ui-dialog')
.css({position: 'absolute', zIndex: "101",width: options.width,
height: options.height})
// bind the click event to the creation of ui-dialog
.bind("click", function(){
// action to fire on click
$('.ui-dialog').css({zIndex:99});
$(this).css({zIndex:100});
});
This does appear to do the trick but is that the best way, or is the
better way of maybe achieving the same effect ?
Chers
Stephen