gpt4 book ai didi

javascript - bootstrap wysihtml5 只读文本区域

转载 作者:行者123 更新时间:2023-12-03 11:31:40 24 4
gpt4 key购买 nike

我正在使用 wsyihtml5 (0.3.0) 和 bootstrap 来使文本区域能够编辑富文本。

一切正常,除了我需要只读它。

//Element declaration
<textarea readonly name="overview" class="form-control" id="OverviewContent" style="width: 100%; height: 200px"></textarea>

[...]

//JS at bottom of page
<script>
$("#OverviewContent").wysihtml5(
{
"font-styles": false,
"color": false,
"emphasis": false,
"textAlign": false,
"lists": false,
"blockquote": false,
"link": false,
"table": false,
"image": false,
"video": false,
"html": false
});

$(document).ready(function()
{
alert("Starting disable");

//I've tried all three of these lines individually
$('#OverviewContent').data('wysihtml5').editor.disable()
//$('#OverviewContent').data('wysihtml5').editor.composer.disable();
//$('#OverviewContent').data('wysihtml5').editor.composer.element.setAttribute('contenteditable', false);


alert("Disabled?");
});
</script>

文本区域似乎始终保持可编辑状态。

警报弹出正常,chrome 中没有控制台错误,文本区域显示富文本正常。

最佳答案

$(document).ready(function() 
{
$('#OverviewContent').wysihtml5();
alert("Disabled?");
});

仅在文本区域中使用禁用

<textarea disabled name="overview" class="form-control" id="OverviewContent"  style="width: 100%; height: 200px"></textarea>

关于javascript - bootstrap wysihtml5 只读文本区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26706586/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com