gpt4 book ai didi

javascript - 使DIV中的内容不可编辑

转载 作者:行者123 更新时间:2023-11-28 04:57:00 25 4
gpt4 key购买 nike

我想让 DIV 中的内容不可编辑但仍可查看。

<div id="committee"><?php include 'committee_members_list.php'; ?></div>

DIV 在其中保存“包含”文件的内容。我希望内容可见但不可编辑或不可点击。

enter image description hereDIV 的内容如上所示。

注意:text 和 textarea 元素不在 DIV 中的包含文件中

DIV 中的所有内容都应该按原样显示,但没有任何内容应该是可点击/可编辑的。我怎样才能实现/实现这个?

最佳答案

div 通常是不可编辑的。如果你想要一个不可编辑的文本框,添加“只读”:

<input type="textbox" name="test" readonly>

编辑:或者您可以通过具有用户选择属性的 CSS 阻止它:

.unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

请记住,这不是验证,我可以使用 firebug 或类似工具修改其中的内容。

关于javascript - 使DIV中的内容不可编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21114077/

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