javascript - Calling a function in a jQuery event is not working -


so have pair of <select> boxes , have jquery script transfer selected <option>s 1 select box other. have function opposite. works fine except when "put back" <option>s first <select> appended bottom instead of alphabetically before.

so found function courtesy of this question:

function sortselect() {     var options = $('#inactivetickers option');     var arr = options.map(function(_, o) {         return {             t: $(o).text(),             v: o.value         };     }).get();     arr.sort(function(o1, o2) {         return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0;     });     options.each(function(i, o) {         console.log(i);         o.value = arr[i].v;         $(o).text(arr[i].t);     }); } 

then have jquery captures click event on link id #remove:

$('#remove').click(function() {       return !$('#activetickers option:selected').remove().appendto('#inactivetickers');       sortselect();   });  

so first line in function moving of <option> tags , second should call sortselect function. trouble don't think sortselect function being called (there nothing in console log , function should write it). what's wrong code?

functions stops when use they're return . don't understand why you're using return stuff ,considering appendto() not return (btw don't need return anything) .

$('#remove').click(function() {   $('#activetickers option:selected').remove().appendto('#inactivetickers');   sortselect(); });  

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -