0

This question already has an answer here:

I have people picker field "Manager" and want it to auto populate in new form with constant value "kumar, brishal" How I can do it using jquery.

I am using below code, when I double click in textbox it show "kumar, brishal" but user will not like this UI. please help

<script  type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link  type="text/css" rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/ui-

lightness/jquery-ui.css" /> 
<script  type="text/javascript" 

src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-

2014.02.js"></script>
<script  type="text/javascript" 

src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-

2014.02.min.js"></script>
<script 

src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-

2014.02.min.js" type="text/javascript"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script> 
<script type="text/javascript">

$(document).ready(function() {


 var defaultuser = "kumar, brishal";
$('input[title="Project manager"]').val(defaultuser);




});

</script>

enter image description here

marked as duplicate by Gautam Sheth, Gaurravs, Nadeem Yousuf, wjervis, Asad Refai May 3 '18 at 14:58

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.

  • just set default value by editing the column – Gopal Zadafiya May 3 '18 at 7:35
  • how? we do not have option to set default value in people picket like choice field – Brishal May 3 '18 at 7:48
  • Sorry, I was not sure about it. – Gopal Zadafiya May 3 '18 at 7:51
0

You could add a placeholder attribute on the field to hold that value. This way you do not have to have a hard default value for it. Try this:

$('input[title="Project manager"]').attr("placeholder", "kumar, brishal");

That should do it.

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