我有一些可在同一页面编辑的表单。 每个文本框的第一个属性是只读的,当我按下编辑按钮时,它将变为可编辑的,使用此语法
$('input[readonly="readonly"]').removeAttr("readonly").prop("enabled",true);当我按下保存按钮时,我希望它再次成为只读状态。 我试图改变它
$('input[readonly="readonly"]').attr("readonly").prop("disable",true); and $('input[readonly="readonly"]').attr("readonly").prop("readonly",true);但它不会再变成只读。
有没有正确的方法来做到这一点?
I have some form which is editable in the same page. First attribute for each textbox is readonly, and when I press the edit button, it will become editable, using this syntax
$('input[readonly="readonly"]').removeAttr("readonly").prop("enabled",true);when i press the save button, i want it become readonly again. I've trying to change it to
$('input[readonly="readonly"]').attr("readonly").prop("disable",true); and $('input[readonly="readonly"]').attr("readonly").prop("readonly",true);but it won't change into readonly again.
Is there any proper way to do this?
最满意答案
按下编辑按钮时删除了只读属性。
所以, $('input[readonly="readonly"]')与任何东西都不匹配。
例如,
$('input[type="text"]').attr("readonly", "readonly");
将所有文本框设置为只读。
readonly attributes was removed when you press the edit button.
so, $('input[readonly="readonly"]') doesn't match anything.
For example,
$('input[type="text"]').attr("readonly", "readonly");
will set all textboxes to readonly.
发布者:admin,转转请注明出处:http://www.yc00.com/web/1690546459a367697.html
评论列表(0条)