-1

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.

Surendra Mourya
  • 593
  • 3
  • 8
  • 29

2 Answers2

0

Try use this - change <YOUR_PEOPLE_PICKER_ELEMENT_ID> to your element id:

SPClientPeoplePicker.SPClientPeoplePickerDict.<YOUR_PEOPLE_PICKER_ELEMENT_ID>_TopSpan.SetEnabledState(false);
$('#' + SPClientPeoplePicker.SPClientPeoplePickerDict.<YOUR_PEOPLE_PICKER_ELEMENT_ID>_TopSpan.TopLevelElementId).find('.sp-peoplepicker-delImage').hide();
0

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

Surendra Mourya
  • 593
  • 3
  • 8
  • 29