input标签 失去焦点无法输入值和改变值

森_ 2016-08-06 10:26:12
var text = "<th><input type='text' ms-duplex='el.order0'/></th>" +
"<th><input type='text' value='"+useCondition+"'/></th>" +
"<th><input type='text' value='"+formula+"' /></th>" +
"<th><input type='text' value='"+resultVar+"' /></th>" +
"<th><button class='btn btn-primary' ms-click=''confirmData($index)'>确定</button>" +
"<button class='btn btn-primary margin-left-10' ms-click='cancelData($index)'>取消</button> </th>";
$(".tbalefromulaclick .tbaletbodyfromulaclick").click(function (){
$(this).children('tr').eq(index).html(text);
});
...全文
533 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Halo!!! 2020-04-03
  • 打赏
  • 举报
回复
<input type="text" value="disabled" disabled >
u_fzp 2016-08-08
  • 打赏
  • 举报
回复
保存的时候加上这个$("#nje2").prop("readonly", "readonly");
jio可 2016-08-08
  • 打赏
  • 举报
回复
引用 3 楼 qq_33075157 的回复:
不是这个,这段代码运行以后,就不能输入 失去焦点。 哪里写错了吗?我需要编辑input
你点击事件是绑定在表格上面的,你点击新生成的input文本的时候事件会冒泡到table上面再次执行生成input的内容,所以会一直循环新建input的动作。解决办法是在表格最后一列添加一个编辑的按钮,点击按钮执行你的click事件函数内容。
jio可 2016-08-08
  • 打赏
  • 举报
回复
你这样写不合适吧,点击行的时候就把里面的内容替换成input text内容,如果我点击了行输入了编辑的值然后点击取消,表格之前的数据就丢失了,难道你要重新去获取一次?给你个方案是在每个tr里面多写一个编辑的块隐藏起来,当点击一行的时候就隐藏之前显示的input块显示出来. ps:
<th><span class="txt">{{el.order0}}</span><span class="edit hide"><input type='text'  value='"+order0+"'/></span></th>
.hide{display:none}
似梦飞花 2016-08-06
  • 打赏
  • 举报
回复
readonly
森_ 2016-08-06
  • 打赏
  • 举报
回复
<table class="table table-hover table table-hover file-table dataTable no-footer tbalefromulaclick" id="havingData" style="width: 1000px;"> <thead> <tr> <th>序号</th> <th>条件</th> <th>公式</th> <th>变量</th> <th></th> </tr> </thead> <tbody class="tbaletbodyfromulaclick"> <tr ms-if="data.tableData.length == 0" > <th colspan="5">无任何数据!</th> </tr> <!-- ms-focus="" ms-blur="" --> <tr ms-repeat="data.tableData" > <th>{{el.order0}}</th> <th>{{el.useCondition}}</th> <th>{{el.formula}}</th> <th>{{el.resultVar}}</th> <th> <a ms-click="addformula($index)"><img alt="" id="add" src="images/u346.png"></a> <a ms-click="deleteformula($index)"><img alt="" id="add" src="images/u342.png"></a></th> </tr> </tbody> </table>
森_ 2016-08-06
  • 打赏
  • 举报
回复
不是这个,这段代码运行以后,就不能输入 失去焦点。 哪里写错了吗?我需要编辑input

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧