jQuery doesn't work on items already processed -
$(document).ready(function() { $('#userid option').dblclick(function() { return !$('#userid option:selected').remove().appendto('#removelist'); }); $('#removelist option').dblclick(function() { return !$('#removelist option:selected').remove().appendto('#userid'); }); }); this works items transferred other list cannot transferred back, other items in other list can transferred back.
delegate event containers not statically linked on element itself..
$(document).ready(function() { $('#userid').on('dblclick','option', function() { return !$(this).remove().appendto('#removelist'); }); $('#removelist').on('dblclick','option',function() { return !$(this).remove().appendto('#userid'); }); }); (i changed inner selectors this. if moving multiple items @ once should use original ones)
(you not need remove() them first, appending them other list, remove them current 1 ie. $(this).appendto('#removelist'))
demo at http://jsfiddle.net/hacv5/
Comments
Post a Comment