如何在链接按钮上启用文本框单击,我正在禁用html中的文本框
下面是我尝试使用的jquery代码:
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('#lEdit').click(function () {
$('#CorporationName').removeAttr('disabled');
});
});
</script>
<asp:LinkButton ID="lEdit" runat="server" ClientIDMode="Static" >Edit</asp:LinkButton>
<asp:Label ID="lblCorporationName" runat="server" Text="Corporation Name" Width="130px"></asp:Label>
<asp:TextBox ID="CorporationName" runat="server" Width="250px" ClientIDMode="Static" Enabled="false"></asp:TextBox>发布于 2013-02-09 06:48:07
看起来你做得很对。如果这不起作用,请尝试:
$('#CorporationName').prop('disabled', false);发布于 2013-02-09 06:49:42
虽然将属性设置为false或甚至为空可能会起作用,但您可能希望尝试使用jQuery's removeProp() function。它就是为此而设计的。
描述:移除匹配元素集的属性。
$('#CorporationName').removeProp('disabled');请注意,以这种方式删除属性后,您将无法再次禁用textbox。
https://stackoverflow.com/questions/14782569
复制相似问题