0

This question already has an answer here:

I want to do some operation based on the user entered in the people picker control.

My code is:

$(document).ready(function () {    
$("input[title='Project Owner']").focusout(function () {

    //var User = $("textarea[title='People Picker']").val().split("\\");
     //user = $.trim($("#Project Owner").text());
    //var user = $().SPFindPeoplePicker({
    //    peoplePickerDisplayName: "Project Owner"

    //});
    alert("Hello");
    var user = $(this).val();

    alert(user);

});
});

The foucusout() event runs perfectly but I am not getting the user name. What should I do?

marked as duplicate by Eric Alexander, John Chapman, Robert Lindgren, Benny Skogberg, RJ Cuthbertson Nov 2 '13 at 2:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

After searching too much I got some thing to get the display name of the user:

code is here:

$(document).ready(function () {
$("input[title='Project Owner']").focusout(function () {




    var loginName = $("span.ms-entity-resolved").attr("title");

    alert("Login Name:" + loginName);

    var displayName = $("span.ms-entity-resolved div:first-child").attr("displaytext");

    alert("Display Name :" +displayName);

});

});

Hope this helps to other.

0

The People Picker controls are tricky little things.

You might want to take a look at this blog post by Marc Anderson which seems to cover the ground to wish to.

  • I went through that blog post could not get idea that's why I posted my question here. – users1100 Nov 1 '13 at 9:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.