我有以下 html -:
<div contenteditable="true">Hey man <a class="ddt">Harry</a></div>
我希望用户无法选择 a.ddt
元素。简单来说就是div里面的其他内容都可以被选中,但是a.ddt
是不能被选中的。
我该怎么做...感谢您的帮助。
最佳答案
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 的原创文章.
关于jquery - 禁止元素被选中 - Jquery 和 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16279180/