Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Possible Duplicate:
Sharepoint 2010 ModalDialog title

Hi,

I am creating a popup window in sharepoint using this code in javascript.

function openAutoResizableDialog(title, url, CallResult) {
    var options = { url: getUrl(url),
        title: title,
        allowMaximize: true,
        showClose: true,
        autoSize: true,
        dialogReturnValueCallback: CallResult
    };
    ModalDialog = SP.UI.ModalDialog.showModalDialog(options);
    return ModalDialog;
}

I want to know if anyone has an idea on how to change the title of the Modal Dialog dynamically when it is open.

For example when the popup opens the title is "my title" and when i press a button in the page that is contained in the popup the title changes.

Can it be done?

Thank you for your time.

share|improve this question

migrated from stackoverflow.com May 20 '11 at 13:50

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Andrey Markeev, Anders Rask May 20 '11 at 21:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

Of course it can be done. It's just HTML isn't it?

When using jQuery

$("#dialogTitleSpan").text("Some other title.");

Javascript only solution

document.getElementById("dialogTitleSpan").innerHTML = "Some other title";
share|improve this answer
up vote 1 down vote accepted

This is what i ended up doing. It worked perfectly.

SP.UI.UIUtility.setInnerText(parent.document.getElementByI("dialogTitleSpan"), "hello");

Or:

parent.document.getElementById("dialogTitleSpan").innerHTML = "Hello";
share|improve this answer