【发布时间】:2017-10-12 04:53:40
【问题描述】:
要创建jquery datepicker,我们使用以下函数
$( function() {
$( "#datepicker" ).datepicker();
} );
<input type="text" id="datepicker">
我正在尝试使用以下新记录功能实现内联编辑功能
function createRowForAdd(){
var tRow = "<tr>"
for(var i = 0; i < array.length; i++){
var jsonObj = array[i];
tRow +="<td><input type='text' id='"+jsonObj.id+"' /></td>"
}
tRow += "</tr>";
return tRow;
}
function Add(){
var tRow = createRowForAdd();
$("#tblId tbody").append(tRow);
}
<button id="btnAdd" onclick="javascript:Add()">New</button>
<table id="tblId" border="1">
<thead>
<tr>
<th>Name</th>
<th>Birth Date</th>
<th>Joining Date</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
一个或多个列可能包含一个日期字段。对于那些列,我想显示一个日期选择器。据我了解,一旦 DOM 准备就绪,就会触发 document.ready 函数。是否可以在添加行时启动日期选择器?
【问题讨论】:
-
你能告诉我你的整个代码吗?
-
用完整代码编辑的问题
-
是日期选择器输入类型='text' id='"+jsonObj.id+"' />
标签: javascript jquery jquery-ui datepicker