handlebars用each做循环遍历给表格模板赋值后为什么form表单中的值(如acount)取不到了,点击事件已触发。

CICIDTY 发布于 2016/04/07 14:20
阅读 313
收藏 0


<script id="tmpt-list-user-all" type="text/x-handlebars-template"
charset="utf-8">




{{#if this}}
{{#each this}}
<tr id="{{id}}">
<td>{{index}}</td>
<form id="deleteOne-form">
<td><input type="text" name="account" value="{{account}}"></td>
</form>
<td>{{name}}</td>
<td>{{lev}}</td>
<td>{{lan}}</td>
<td>{{#if online}}
<span class="am-badge am-badge-success">在线</span>
{{else}}
离线
{{/if}}
</td>
<td>{{#if state}}
启用
{{else}}
<span class="am-badge am-badge-danger">禁用<a>
{{/if}}
</td>
             <td>




<div class="am-btn-toolbar">




<span class="am-centered">
<button
class="am-btn am-btn-default am-btn-xs am-text-secondary">
<span class="am-icon-pencil-square-o"></span> 编辑
</button>
<button id="deleteOne" onclick="deleteOne()"
class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
<span class="am-icon-trash-o"></span> 删除
</button>
</span>




</div>
</td>
</tr>
{{/each}}
{{else}}
<tr><td colspan="7">暂无用户信息</td></tr>
{{/if}}




</script>






JS代码:


function deleteOne(){
alert("123");
var par = felseiei.fcvt.toJO('#deleteOne-form');
if (felseiei.fcvt.have(par, 'account')) {
felseiei.post('delete_one', {
par : par
});
} else { 
alert('删除失败!');
}
}


加载中
返回顶部
顶部