$(".tjbtn").click(function(){ $('#leader').each(function(index, ele){ var leader = ele.value; var leader1 = ele.selectedIndex; var leader2 = ele.options[leader1].text; /* for (var i =0;i < ele.chirdNodes.length; i++) { var leadert = ele; } */ var a = leader.split(","); var b = a[0]; var c = $(".textc").html() + b + " ,"; var a1 = leader2.split(", "); var b1 = a1[0]; var c1 = $(".textt").html() + b1 + " ,"; $(".textc").html(c); $(".textt").html(c1); }); }); });
JS获取value 以option及内容代码
获取AJAX后拼接的代码
html+="<option id="+leader[i-1].userCode+" title="+leader[i-1].userName+" value="+leader[i-1].userCode+">"+leader[i-1].userName+"</option>";