I am trying to set Look Up Drop down using JavaScript/Jquery. I am able to set the value but while saving by default 1st option in drop down is Set.

Thanks in Advance...!!!

  • you have to set value in this format -> 12;#Value
    – Gaurravs
    Commented Dec 10, 2015 at 10:02
  • can you add your code? Commented Dec 10, 2015 at 10:02
  • item ID of the lookup value from where it actually exists and the value of that field
    – Gaurravs
    Commented Dec 10, 2015 at 10:02

2 Answers 2


native Javascript, no jQuery

function setOption( selector , value , allowMultiple ){
  var options=document.querySelector( selector ).childNodes;
  for(var i=0;i<options.length;i++){
    var option=options[i];
    if (!allowMultiple) option.removeAttribute('selected');
    if (option.getAttribute('value')===value || i===value+1) option.setAttribute('selected','selected');

//set one value by name 
setOption( "select[title='Task Status']" , 'Completed' , false );

//set multiple values by number
setOption( "select[title='Task Status']" , 1 , true );

Code below helped me to set the LookUp value of DropDown in default edit/new form of List

var ValuetoSet="test";
var FieldToSet = $('select[title="Customer ID"]');
$.each(dataClsField[0],function(){if($(this).text() == ValuetoSet) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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