0

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

A.Saéed
  • 1,647
  • 8
  • 17
Brishal
  • 1,205
  • 11
  • 42
  • 59

1 Answers1

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.

lazoDev
  • 1,806
  • 14
  • 20