Friday, 4 April 2014

Count the selections inside a people picker control

Dear Readers,

This is another of my people picker post where I will write how using jQuery you can count the number of entities/users you have provided inside your people editor control. For my previous posts on people editor refere to the links link1 and link2 .

Coming back to the scenario, at times you need to do client side validation to see how many entities you have entered inside the people editor control. You have an attribute MultiSelect="false" that you can set  on the SharePoint:PeopleEditor control to show an error message stating that only one value is allowed to be entered in the people editor control. Now if you want to do the same validation using jQuery then its really simple. Below is the code snippet for the same.

var noOfChildren = $("[id$='peopleEditorProductOwner_upLevelDiv']").children().length;

where 'peopleEditorProductOwner' is the id of the people editor control.
Hope that helps !


  1. Hi.I have been following your posts and your contributions in technet forum. this is lakshman. I would like to have your personal email id for some clarifications?

    1. Happy to help . Please provide your mail id and I will drop you a test mail.

  2. Hi Geetanjali,

    I have to do the same in SP 2013. If you have anything please mail me (