标签:join option class var 操作 ted app his javascrip
$(function () { function MoveItem(fromId, toId) { $("#" + fromId + " option:selected").each(function () { $(this).appendTo($("#" + toId + ":not(:has(option[value=" + $(this).val() + "]))")); }); $("#" + fromId + " option:selected").remove(); } $("#addUser").click(function () { var fromId = "User"; var toId = "UserSelected"; MoveItem(fromId, toId); }); $("#removeUser").click(function () { var fromId = "UserSelected"; var toId = "User"; MoveItem(fromId, toId); }); //双击选项 $(‘#User‘).dblclick(function () { var toId = "UserSelected"; var fromId = "User"; MoveItem(fromId, toId); });
Jquery操作select,左右移动,双击移动
取到所有option的值
var str = $("#UserSelected option").map(function () { return $(this).val(); }).get().join(",")
Jquery操作select,左右移动,双击移动 取到所有option的值
标签:join option class var 操作 ted app his javascrip
原文地址:http://www.cnblogs.com/zitjubiz/p/6070681.html