I am trying to clear a multi value lookup field using javascript when an item is re-edited.

I have tried all the following combinations without success



I have had limited success with the following:

var value = $("input[id$='Test']").val();
var regex = /\|t/g;
var value = value.replace(regex, ';#');
var vars = value.split(';#');
for (var i = 0; i < vars.length; i++) {
        $("[id^='Test'] option[value='"+vars[i]+"']").remove();

In this last one, it does clear all the values from the display box, but does not seem to change the underlying data as all the selected items still appear on the list after the close of the edit form.

The following link seems to be relevant - Clear Multiselect Lookup the only difference is that I don't want a button to initiate the Clear.

The other reference I found was: http://www.dotnetspark.com/kb/6185-set-defaulting-values--removal-multi-lookup.aspx

How can I clear the selected options using Jquery? Is there another easy way of doing this?


Answer is here:


SP2013 code is:

function clearChoice(columnName) {

$("[title='" + columnName + " selected values'] option").each(function () {

        $(this).appendTo($("[title='" + columnName + " possible values']"));
        var multilookupPickerVal = $("[id$='MultiLookup']").val();
        var valToRemove = $(this).val() + "|t" + $(this).text();
        var newValue = multilookupPickerVal.replace(valToRemove, "");





Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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