Tag: operations

j

jQuery: Add (all), Remove (All) – operations between two Listboxes

Consider the scenario below: In case of operations between two list boxes like add, add all, remove, remove all; jQuery is quite amazing with it. With the use of appendTo method, you just need one line for each of the four operations. Checkout the code below: $(document).ready(function(){ $("#btnAdd").click(function() { $("select[id$='lstAllAgents'] > option:selected").appendTo("select[id$='lstGroupMembers']"); }); $("li#btnAddAll").click(function() { ...