我有一段动态调用的 jquery 代码,并生成任意数量的 tr 标签。在每个 tr 标记中,我都有一个设置为 jquery ui datepicker 的文本类型的输入。无论生成多少个 tr 标签,日期选择器都会一致地呈现除最后一个标签之外的每个 tr 标签。我错过了什么?这是负责的jquery代码:
// create order row
var addOrderRow = function(id, name) {
var self = this;
self.Name = name;
self.Id = id;
self.Output = "<tr><th>Code</th><th>Product</th><th>Options</th><th>Size</th><th>Package</th>" +
"<th>Price</th><th>Quantity</th><th>Delivery Date</th></tr>" +
"<tr><td><select name='prodCode'></select></td><td><select name='product'></select>" +
"</td><td><select name='options'></select></td><td><select name='size'></select></td><td>" +
"<select name='package'></select></td><td><select name='price'></select></td>" +
"<td><input type='text' name='quantity'></input></td><td><input type='text' " +
"name='deliverDate'></input>" +
"</td></tr>";
// assign datepicker to deliverDate
$(function() {
$("input[name=deliverDate]").datepicker({minDate: 0});
});
// populate product code
getPcodeProducts();
return self.Output;
};