Please tell me how to clear the value PeoplePicker in JavaScript (JQuery)? Tried a lot of examples, nothing works.



I don't see what you are trying to accomplish as Author is the internal name for the field Created By but here goes.

<script language="javascript" type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<script src="../_layouts/15/clienttemplates.js"></script>
<script src="../_layouts/15/clientforms.js"></script>
<script src="../_layouts/15/clientpeoplepicker.js"></script>
<script src="../_layouts/15/autofill.js"></script>
<script language="javascript" type="text/javascript">

/*Finds and deletes the resolved users in the people picker control "Test" if there are more than zero user present.*/ 

$(document).ready(function() {
peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[$('[Title*="Test"]')[0].id];
    if (peoplePicker.TotalUserCount > 0) {
  • @Cristoffer Failed to get the "TotalUserCount" property of a reference whose value is not defined or is NULL – Fox Apr 25 '18 at 9:13
  • Think i missed out 2 references.. try again. Or are you trying to manipulate the created by field? The field need to be in the actual form. If the reference is null = field not found. – Christoffer Apr 25 '18 at 9:14
  • @Cristoffer Tried different options, even created a field people picker "Test", the same mistake "Failed to get the TotalUserCount" property of a reference whose value is not defined or is NULL" – Fox Apr 25 '18 at 9:38
  • Can you debug? What SharePoint version? Should have specified that this is for 2013, hence the reference to _layouts/15. – Christoffer Apr 25 '18 at 9:58
  • Reference it's Ok, SharePoint 2013 Ent., debug only same error... – Fox Apr 25 '18 at 10:04

Following scripts works for me for ClientPeoplePicker. The DeleteProcessedUser method requires span element of resolved user.


function removeAllUsers(peoplePickerId){
    var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict["ctl00_PlaceHolderMain_" + peoplePickerId + '_TopSpan'];

    var selectedUsers = peoplePicker.GetAllUserInfo();
    var userToRemoveKey = selectedUsers[1].Key; 

    var resovledListElmId = peoplePicker.ResolvedListElementId;
    $('#' + resovledListElmId).children().each(function(index, element) {


  • Your code does not understand the connection between my Title field "Author"? The normal column that is created in the list and fill in Newform.aspx, JS code is added via Content Editor. There is not project VS. – Fox Apr 25 '18 at 12:04

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.