单击伪元素时可以设置光标/插入符号吗?
我使用此 css 将 Pilcrow 字符(无关紧要)设置为段落的后元素
body.p:after {
content:'\00b6'; // the used char or image does not matter
}
当我在正文内的后元素之后单击时,光标/插入符号将按需要放置在段落末尾。但是,当我单击后元素时,不会显示光标,并且输入某些字母不起作用。
有解决方法吗?
I am setting a Pilcrow character (does not matter) as after element to a paragraph using this css
body.p:after {
content:'\00b6'; // the used char or image does not matter
}
When i click after the after element inside the body the cursor/caret gets placed at the end of the paragraph as wished. But when i click on the after element no cursor is shown and typing in some letters does not work.
Is there a workaround for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我对问题的解决方案。
OnClick 我检查单击事件的偏移量是否等于最大文本节点长度,以便决定是否需要设置插入符号。
这里的目标是当单击 after 元素时将光标设置到实际段落的末尾。
Here is my solution to the problem.
OnClick i check if the offset of the click event equals the maximum textnodelength in order to decide if the caret needs to get set or not.
Goal here was to set the cursor to the end of the actual paragraph when clicked on the after element.