Skip to content Skip to sidebar Skip to footer

How To Retain Select2 Results After Select?

For example, when using select2 muti-value, user entered 'new', and it showed New Mexcio New Hampshire New Jersey New York After selecting 'New Mexcio', and the user would lik

Solution 1:

Sounds like you want to persist a query from one search to the next. You might want to check out the nextSearchTerm property.

To display the current value in the next search,

functiondisplayCurrentValue(selectedObject, currentSearchTerm) {
  return currentSearchTerm;
}

$("#e1").select2({
  nextSearchTerm: displayCurrentValue
});

Post a Comment for "How To Retain Select2 Results After Select?"