$.ajax({
type: "POST",
contentType: 'application/json;charset=utf-8',
dataType:'json',
url: 'generatequotations',
data: JSON.stringify(),
success: function(result) {
// alert("success");
console.log(result);
$.each(result, function(i, item) {
tr = $('<tr/>');
tr.append($("<td/>").html('<input type="text" name="unit_price" id="unit_price"/>'));
tr.append($("<td/>").html('<input type="text" readonly="true" name="total" id="total"/>'));
$('#tbl_items').append(tr);
});
}
});
<body>
<table id="tbl_items"></table>
</body>
假设上面的代码会在表中生成10个“unit_price”文本框,我需要的是我想单独获取这10个文本框的值以供进一步计算。帮我怪才......如何分别从动态生成的文本框中获取值?
链接到屏幕截图http://oi62.tinypic.com/255hslc.jpg
两行动态生成的我想每个文本框(“UNIT_PRICE”)内相应的总(“总”)文本框
您需要在输入加载后编写代码,即在追加tr后。 –
追加tr后,我得到了一个动态生成的文本框表。我需要分别获取这些动态文本框的值。 – DON