I do not want to apply $ twice ('# selecteShuffle')
 < Code> Sort sort function (select) {select.html ($ ('select option'). Sort (function (A, B) {return a.text == b.text? 0: a.text & lt; B.text? - 1 1;})); } $ ('#SearchShuffle'). Change (Sort ($ ('# selectShuffle')));     
  do this -  
  $ (' #selectShuffle 'change (sortSelect).    and in your function -   this  refer to your selection     function sort select ( E) {$ (This) .html ($ ('select option'). Sort (function (a, b) {return a.text == b.text? 0: a.text & lt; b.text? - 1: 1;})); }    Or you can do it like this ( without changing your current function setup )    function sort Select (Select) {Select.html ($ ('select option'). Sort (function (a, b) {return a.text == b.text? 0: a.text & lt; b.text? - 1: 1;})); } $ ('#SearchShuffle'). Change (function () {sortSelect ($ (this))});    
 
No comments:
Post a Comment