Is there a way to display the results (divs) in the order of the most recent selection when making multiple selections from a list? Currently, the results appear in the order they are listed in the box. For example, if I select Nuts, Meats, Vegetables, Fruits in that order, how can I make the results show Fruits, Vegetables, Meats, Nuts?
https://jsfiddle.net/djj2c84t/
jQuery.fn.filterByText = function(mytextbox) {
// code for filtering options based on text input
};
$(function() {
$('#mydropdown').filterByText($('#mytextbox'), true);
});
$(document).ready(function() {
// code for handling changes in dropdown selection
});
I have been struggling with this issue for months and haven't found a suitable solution online yet. Any help or example code provided would be greatly appreciated since my knowledge in Javascript, JQuery, and CSS is limited.
Thank you.