I am using select2 plugin. My functionality is like that when the user selects the value from select2 drop down redirect the page to the new page. But, when user clicking on back button of browser. I observed the placeholder of select2 dropdown is missing and the last value is already showing selected. Can anyone help me to solve this problem.

$('#selectedSearch').select2({
  containerCssClass: 'selectedUniversalSearchCss',
  placeholder: "Search",
  minimumInputLength: 0,
  allowClear: true,
  ajax: {
    //How long the user has to pause their typing before sending the next request
    quietMillis: 150,
    //The url of the json service
    url: SearchURL,
    dataType: 'jsonp',
    //Our search term and what page we are on
    data: function(term, page) {
      return {};
    },
    results: function(data, page) {}
  }
});

0 Answers