Tuesday, 20 August 2019

how to clear client people picker

How to clear a client people picker



ClearClientPeoplePicker("ClientPeoplePicker_TopSpan");

function ClearClientPeoplePicker(controlId)
{
        //var fieldName = id + '_TopSpan';
        var peoplePickerDiv = $("[id$='" + controlId + "']");

        // Get the people picker object from the page.
        var peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];

        var usersobject = peoplePicker.GetAllUserInfo();
        usersobject.forEach(function (index) {
            peoplePicker.DeleteProcessedUser(usersobject[index]);
        });
}

No comments:

Post a Comment