我有以下html - :
<div contenteditable="true">Hey man <a class="ddt">Harry</a></div>
我希望用户无法选择a.ddt
元素。简单来说,可以选择div中的所有其他内容,但无法选择a.ddt
。
我该怎么做...感谢您的帮助。
答案 0 :(得分:1)
Disabling Selection in jQuery, 可以通过$('。button')。disableSelection();
调用或者,使用CSS(跨浏览器):
.button {
-moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; }
原帖aleemb。
答案 1 :(得分:0)
无法在DOM上添加此限制。
答案 2 :(得分:0)