I'm trying to get ClientPeoplePicker control with following code.

    function setCPP(userAccountName, controlName) {
    var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
    var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
    var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];

I can get peoplePickerEditor and peoplePickerDiv[0].id without problem, but spPeoplePicker is undefined. What did I miss?


Resolved issue by adding timeout. Before that the function works in IE11, with timeout added also works in IE10.

 ExecuteOrDelayUntilScriptLoaded(function () {
        setTimeout(function () {
            setCPP(userAccountName, controlName);
        }, 2000);
    }, 'clientpeoplepicker.js');
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.