依然同上~ 点击获取当前option的value与text

 $(".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>";
上一篇:ecshop自动确认收货(无其他商家)


下一篇:关于web开发中订单自动超时和自动收货的简单方法(window server)