0
你好ID喜欢拿当前元素触发该事件内此事件,jQuery函数
理想我需要的ID,选择的值和类,在此先感谢
$(document).ready(function() {
$("#positions select").live("change", function() {
var id = $("#category_id").val();
//var id = this.val();
alert(id);
$.getJSON("/Category/GetSubCategories/" + id, function (data) {
if (data.length > 0) {
alert(data.length);
var position = document.getElementById('positions');
var tr = position.insertRow(7);
var td1 = tr.insertCell(-1);
var td = tr.insertCell(-1);
var sel = document.createElement("select");
sel.name = 'sel';
sel.id = 'sel';
sel.setAttribute('class', 'category');
// $("positions select").live("change", function() {
//});
td.appendChild(sel);
$.each(data, function (GetSubCatergories, category) {
$('#sel').append($("<option></option>").
attr("value", category.category_id).
text(category.name));
});
}
});
});
});
对不起,什么?你能否提供更多细节,我没有得到你想说的话。 – RaYell 2010-04-22 11:52:57