问题描述
htmlcode:
div id="divUndo" runat="server"
在某些情况下,我使用以下语句在后面的代码中禁用divUndo.VB.NET:
I am disabling divUndo in the code-behind under certain conditions using the below statement.VB.NET:
divUndo.disabled=true
我如何检查是否禁用了divUndo
?
How can I check if the "divUndo
" is disabled or not using jquery?
推荐答案
ASP.NET允许您在任何HtmlControl对象上设置Disabled
属性.在您的示例中,它呈现为
ASP.NET allows you to set Disabled
attribute on any HtmlControl object. And in your example it renders as
<div id="divUndo" disabled="disabled"><div>
和javascript中的代码都可以像
and in javascript can be checked like
$('#divUndo').attr('disabled') !== undefined
但是根据W3C
因此,它可能无法在不同的浏览器中工作或有所不同.您不应该依赖在JavaScript或CSS中使用div
上的disabled
属性.
Therefore it may not work or work differently in different browsers. You shouldn't rely on using disabled
attribute on div
in your javascript or css.
这篇关于如何使用jQuery检查DIV元素是否被禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!