如何禁用所有输入字段并提交按钮 onkeypress 特定文本字段的事件
How to disable all input fields and submit buttons onkeypress event of a specific textfield
我在编辑textbox
时触发了一个onkeypress
事件:
.......
<ItemTemplate>
<asp:TextBox ID="txtgvEmailAddress" Text = '<%# Eval("EMAIL")%>' runat="server" Width="200px" onkeypress="DetectUpdate(this)" onclick="ResetMessage();"/>
<asp:Button ID="btnEmailUpdate" Text = "Update" runat="server" CommandName="UpdateEmail" onClientClick="return ValidateEmail(this);"/>
</ItemTemplate>
........
此textbox
是GridView
的一部分,是UpdatePanel
的一部分我有一个方法,当该特定textbox
触发onkeypress
事件时触发。
现在,我正在寻找禁用该GridView
上的所有其他textboxes
以及输入字段的方法,因此,用户在更新完成后无法更改它们
如何做到这一点?
谢谢的
我找到了以下解决方案:
$(function(){
$('input[type="text"]').live("focus", function() {
var rowId = $(this).attr('id');
$('tr').each(function(){
var inputId = $(this).find('input[type="text"]').attr('id');
if(inputId != null && typeof inputId != "undefined"){
if(rowId != inputId){
$(this).find('input[type="text"]').attr("disabled", "disabled");
}
}
});
});
});
这是一个链接:如何在更新成功之前禁用某些控件?但是,我仍然需要禁用与正在更新的textbox
不属于同一行的所有提交控件
我也通过添加以下内容解决了最新的问题:
$(this).closest("tr").find('input[type="submit"]').attr("disabled","disabled");
内部if
语句内部:
if(rowId != inputId){
$(this).find('input[type="text"]').attr("disabled", "disabled");
$(this).closest("tr").find('input[type="submit"]').attr("disabled","disabled");
}
相关文章:
- 将输入字段中的文本提交到我的数据库,同时将其添加到我的列表中
- 而循环只设置php中输入字段中的第一个值
- 在输入字段中将最小金额设置为
- 从Rally获取一个特定的标记,以便计算另一个字段中的值
- 如何在输入字段中的按钮的帮助下打开日历,该字段的类型为“=”;日期”;
- JavaScript 检查隐藏字段中的值并将其设置为隐藏字段值
- 在wordpress一定时间后更改自定义字段
- 如何在HTML输入字段中添加不可删除的后缀
- Meteor-添加用户自定义字段的方法不起作用
- 互斥单选按钮和相应的输入字段
- 在IE9中的输入字段中输入焦点最近按钮
- 选中单选框时将属性添加到输入字段
- 带有验证和隐藏字段值的提交按钮
- 主干窗体隐藏字段未呈现
- 带有let的JS/EECMAScript6私有字段的模式
- 按钮字段确认点击不'不起作用
- jQuery Wan Spinner插件的多个字段
- 使用onkeypress获取字段值
- 输入字段类型文本具有onkeypress调用函数不止一次的属性
- 如何禁用所有输入字段并提交按钮 onkeypress 特定文本字段的事件