【问题标题】:<s:a> attribute disabled not working<s:a> 属性禁用不起作用
【发布时间】:2013-04-08 04:02:38
【问题描述】:

我使用 struts2 之类的:

<s:a id="beforePage" disabled="true">beforePage</s:a> 

但是disabled不起作用,和没有disabled attirbute一样。

令我惊讶的是,当我使用 jquery 时,例如:

<s:a id="beforePage">beforePage</s:a> 
$("#beforePage").attr("disabled","true");

禁用属性工作!所以,我对此感到困惑.. 请给我一个解释,非常感谢。

【问题讨论】:

  • 不能这样禁用链接。

标签: jquery html struts2


【解决方案1】:

Struts2 &lt;s:a&gt;标签最终生成html &lt;a&gt; tag. There is no "disabled" attribute defined intag (i.e.`不支持disabled属性)。因此它不起作用。

【讨论】:

    【解决方案2】:

    在最新版本的 HTML 中,disabled 属性只是存在于元素中,就像这样,或者也作为属性的值:

    <s:a id="beforePage" disabled="disabled">beforePage</s:a> 
    

    【讨论】:

    • 谢谢,但遇到错误:当我尝试您的代码时,应使用等号
    猜你喜欢
    • 1970-01-01
    • 2021-08-28
    • 1970-01-01
    • 2019-01-02
    • 2011-09-12
    • 2021-01-13
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多