jquerysharepointpeoplepicker

How to make peoplepicker field read only on SP 2016


I am facing very simple issue, but i am not able to solve it. I need to make people picker field on Sharepoint 2016 as readonly. I got below code from one answer, but even this dont work.

$(".sp-peoplepicker-delImage").css({ 'display' : 'none'});
$(".sp-peoplepicker-editorInput").css({ 'display' : 'none'});

Any quick fix will be appreciated.

Thanks.


Solution

  • I was able to disble the people picker field with jquery code

    $(".sp-peoplepicker-delImage").hide();
    $("input.sp-peoplepicker-editorInput[title='peoplepickerfield']").prop('disabled', true);
    $("div.sp-peoplepicker-topLevel[title='peoplepickerfield']").addClass("sp-peoplepicker-topLevelDisabled");
    

    enter image description here