Sharepoint - How to get ClientPeoplePicker value using javascript

If you just need to access the values, you could do it like this:

var dispTitle = "APickerField";      
var pickerDiv = $("[id$='ClientPeoplePicker'][title='" + dispTitle + "']");      
var peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[pickerDiv[0].id];
peoplePicker.GetAllUserInfo();

The GetAllUserInfo() returns an array with one index pr entity in the picker, with the following properties available:

enter image description here

Update

This is the form field: enter image description here

And this the tag you need to get the ID from: enter image description here

APickerField_bec5d6be-a12e-4cfd-8046-558427c2687c_$ClientPeoplePicker

So one could just have done it like this:

SPClientPeoplePicker.SPClientPeoplePickerDict["APickerField_bec5d6be-a12e-4cfd-8046-558427c2687c_$ClientPeoplePicker"].GetAllUserInfo()

And if you check the SPClientPeoplePicker.SPClientPeoplePickerDict object, it will have all your pickers.


<pre>/* get value from clientPeoplePicker */

// value from first input field in client people picker div
var data = $("Div[title='Antragssteller'] > input" ).val(); 
var jsonData = JSON.parse(data);

// and now you can see the properties
alert(jsonData[0].DisplayText);
</pre>
/*
    [
    {
    "Key":"i:0#.w|xyz\\xyz",
    "Description":"xyz\\xyz",
    "DisplayText":"Doe, John",
    "EntityType":"User",
    "ProviderDisplayName":"Active Directory",
    "ProviderName":"AD",
    "IsResolved":true,
    "EntityData":
        {"Title":"",
        "MobilePhone":"",
        "SIPAddress":"",
        "Department":"",
        "Email":"xyz@xyz"
        },
    "MultipleMatches":[],
    "AutoFillKey":"i:0#.w|xyz\\xyze",
    "AutoFillDisplayText":"Doe, John",
    "AutoFillSubDisplayText":"",
    "AutoFillTitleText":"xyz@xyz\nActive Directory\xyz\\xyz",
    "DomainText":"xyz.local",
    "Resolved":true,
    "LocalSearchTerm":"xcv"
    }
    ]

*/