Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个 HTML:
<div contenteditable="true"><a>Hello</a></div>
当光标紧跟在 之后时,它会在元素Hello中附加新文本。<a>但它应该在<a>元素之后添加新文本。这个怎么做?
Hello
<a>
好吧,这可能不是最好的解决方案,但是您可以在内容可编辑中添加另一个 div,将其设置为 false 。
<div contenteditable="true"> <div contentEditable="false"> <a href="http://google.com">Google</a> </div> Content here -- Wont change your link. </div>