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

Email Validation for SharePoint list column

SP, UDF and VIEW

Create a SharePoint group and add users using JSOm