Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用什么来代替禁用textarea?_Html_Grails_Gsp - Fatal编程技术网

Html 使用什么来代替禁用textarea?

Html 使用什么来代替禁用textarea?,html,grails,gsp,Html,Grails,Gsp,目前有一个软件不允许你从禁用的textarea中复制内容(在chrome中可以正常工作),我一直在考虑如何替换我的代码,使它在firefox中也可以正常工作。我使用GSP文件,但也可以在其中使用普通html标记 以下是我的代码片段: <g:textArea rows="5" cols="1" name="description" value="${forecast?.description}" class="description-t-area" disabled="${!canEdit}

目前有一个软件不允许你从禁用的textarea中复制内容(在chrome中可以正常工作),我一直在考虑如何替换我的代码,使它在firefox中也可以正常工作。我使用GSP文件,但也可以在其中使用普通html标记

以下是我的代码片段:

<g:textArea rows="5" cols="1" name="description" value="${forecast?.description}" class="description-t-area" disabled="${!canEdit}"/>

下面是它在web上的外观:

问题是您不能将disabled设置为true或false,属性的存在意味着true,例如:

disabled="false" == true
disabled="true"  == true
disabled         == true
您有两个选项,使用纯文本区域并通过javascript有条件地打印
已禁用
或无html标记或设置已禁用

更多信息请点击这里

编辑:刚刚尝试过这是Grails3.2.8,它现在确实可以正常工作了(我已经有一段时间没有看过了,对不起!)


导致

<textarea name="foo" id="foo" ></textarea>
<textarea name="foo" id="foo" disabled="true" ></textarea>


导致

<textarea name="foo" id="foo" ></textarea>
<textarea name="foo" id="foo" disabled="true" ></textarea>

问题在于不能将disabled设置为true或false,属性的存在意味着true,例如:

disabled="false" == true
disabled="true"  == true
disabled         == true
您有两个选项,使用纯文本区域并通过javascript有条件地打印
已禁用
或无html标记或设置已禁用

更多信息请点击这里

编辑:刚刚尝试过这是Grails3.2.8,它现在确实可以正常工作了(我已经有一段时间没有看过了,对不起!)


导致

<textarea name="foo" id="foo" ></textarea>
<textarea name="foo" id="foo" disabled="true" ></textarea>


导致

<textarea name="foo" id="foo" ></textarea>
<textarea name="foo" id="foo" disabled="true" ></textarea>

您可以使用pre-tag,例如

<pre id="description" contenteditable="${!canEdit}">${forecast?.description}</pre>
${forecast?.description}

您可以使用pre-tag,例如

<pre id="description" contenteditable="${!canEdit}">${forecast?.description}</pre>
${forecast?.description}