title: How to sort list item by selecting dropdown option using list.js
body: <p>I am using list.js to sort list item but i want to sort the item on changing the <code>select &gt; option</code></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="hotels"&gt;
      &lt;input class="search" placeholder="Search" /&gt;
      &lt;button class="sort" data-sort="name"&gt;
        Sort by name
      &lt;/button&gt;
  
      &lt;select class="sort" data-sort=""&gt;
        &lt;option value="" selected&gt;Sort by&lt;/option&gt;
        &lt;option value="hotelName"&gt;Hotel Name&lt;/option&gt;
        &lt;option value="price"&gt;Price&lt;/option&gt;
        &lt;option value="star"&gt;Star&lt;/option&gt;
      &lt;/select&gt;
  
      &lt;ul class="list"&gt;
        &lt;li&gt;
          &lt;h3 class="hotelName"&gt;The Umrao&lt;/h3&gt;
          &lt;p class="price"&gt;5002&lt;/p&gt;
          &lt;p class="star"&gt;3&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;h3 class="hotelName"&gt;Welcomhotel Dwarka, New Delhi&lt;/h3&gt;
          &lt;p class="price"&gt;8367&lt;/p&gt;
          &lt;p class="star"&gt;5&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;h3 class="hotelName"&gt;Lemon Tree Premier, Delhi Airport&lt;/h3&gt;
          &lt;p class="price"&gt;3978&lt;/p&gt;
          &lt;p class="star"&gt;4&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;h3 class="hotelName"&gt;Red Fox Hotel, Delhi Airport&lt;/h3&gt;
          &lt;p class="price"&gt;9676&lt;/p&gt;
          &lt;p class="star"&gt;2&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="http://listjs.com/no-cdn/list.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I have done some code but it has bug when i select first time it works but if i go to change again on clicking select it sort item with the previous value and after when dropdown open then i select then it sort with current value.</p>
  
  <p><strong>Here is my code</strong></p>
  
  <pre><code>var options = {
    valueNames: [ 'hotelName', 'price', 'star' ]
  };
  
  var hotelList = new List('hotels', options);
  
  $('.sort').change(function(){
    var selection = $(this).val();
    console.log(selection);
    $(this).attr('data-sort', selection);
  });
  </code></pre>