I have 5 values in my lookup column. I need to select one and show it there by default.


But this is not working, this doesn't set the value of lookup field as Country. Country is already a value in that lookup column.


2 Answers 2


Adding some code as you asked in comment.

<option value="2">Country< /option>

You need the value of the option which has Country in innerHTML.

Get all options by title attribute instead of id as id always generates dynamically.

var allOptions = document.querySelectorAll("[title=Category] option");

Now find Country and set as selected.

var allOptions = document.querySelectorAll("[title=Category] option");

[].some.call(allOptions, function(option) {
    if (option.innerHTML == "Country") {
        option.selected = "selected";
        return true;

PS: Assuming Category is the name of the lookup column. Need to change in your case.


For lookup select options, the value of each option is the Id of the lookup list item, not the display column value.

<option value="2">Country<option>

Here, 2 is the Id of the lookup list item that has value Country for the lookup display column.

You can use the Id if you want to select by value, or you can try selecting by the display value of the option.


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.