给select 赋值,除了已有的value及text,新建一属性simple_name

function GetDicOfficeList(dicType, sid) {
$.ajax({
url: "/Dict/getDictList",
dataType: "json",
data: {
"dictType": dicType
},
success: function (data) {
for (var i = 0; i < data.length; i++) {
$("#" + sid).append($("<option value=\"" + data[i][0] + "\" simple_name=\"" + data[i][2] + "\">" + data[i][1] + "</option>"));
}
}
});

};

 

simple_name的值 :

$("#sDocType").change(function () {
var s = $("#sDocType option[value='" + $("#sDocType").val() + "']").attr("simple_name");
});

posted on 2013-08-19 14:46  小傻瓜  阅读(245)  评论(0编辑  收藏  举报