Reset people picker value in SharePoint using JQuery

Use the following code to reset the people picker control value using JQuery:

Pass the title of the people picker to the below function and it will reset the people picker control value.

function clearPeoplePickerControl(ppTitle)
{
var identifier = $("div[title='" + ppTitle + "']").attr("ID")); ;
var value = '';
var tags = document.getElementsByTagName('DIV');
for (var i = 0; i < tags.length; i++) {
  var tempString = tags[i].id;
 if ((tempString.startsWith(identifier)) && (tempString.indexOf('_upLevelDiv') > 0)) {
      tags[i].innerHTML = value;
     break;
}

Comments

Popular posts from this blog

SharePoint 2019 New Features

Move the list items from one list to another list using PowerShell - SharePoint 2010

Email Validation for SharePoint list column