Call below function after initializing people picker control
var newUserEmailIdGlobalVariable="";
function PeoplePickerChangeEvent()
{
this.SPClientPeoplePicker.SPClientPeoplePickerDict.newEmployeePicker_TopSpan.OnValueChangedClientScript=function (peoplePickerId, selectedUsersInfo)
{
if(selectedUsersInfo.length>0)
{
console.log(selectedUsersInfo[0].EntityData.Email);
newUserEmailIdGlobalVariable=selectedUsersInfo[0].EntityData.Email;
}
else
{
newUserEmailIdGlobalVariable="";
}
$('#txtNewUseremail').val(newUserEmailIdGlobalVariable);
};
}
if does't work then call function in time out to initialize an event
like below
setTimeout(function(){ PeoplePickerChangeEvent() }, 3000);
good post thanks for sharing.
ReplyDelete