First find ID of people picker Div & get the ff part:
People Picker Div ID = "ctl00_ctl40_g_478948c1_e923_4777_9306_26c03d2dade0_**ff181**_ctl00_ctl00_UserField_upLevelDiv";
//Use 'ff181' as an unique reference to this field..number may change across fields but 'ff' is constant
var NoOfUsers = CountUsers('ff181');
function CountUsers(identifier)
{
AppUsrs =[];
var tags = document.getElementsByTagName('DIV');
for (var i=0; i < tags.length; i++)
{
var tempString = tags[i].id;
if ((tempString.indexOf(identifier) > 0) && (tempString.indexOf('UserField_upLevelDiv') > 0))
{
var innerSpans = tags[i].getElementsByTagName("SPAN");
for(var j=0; j < innerSpans.length; j++)
{
if(innerSpans[j].id != 'content')
{ AppUsrs.push(innerSpans[j].id.split('|')[2]);
}
}
return AppUsrs;
}
}
return null;
}
The function CountUsers will return number of users in people picker field.