预先将文本写入文本区域
我想创建文本区域,其中总是预先写好的文本,并且该文本位于末尾,并且无法删除。例如,您在此处写下答案,最后在光标右侧显示文本“这是我的答案的结尾”。
当您发布它时,它会显示您的书面文字,并在末尾显示“这是我的答案”。
我知道,我可以在发布后轻松附加此文本,但它必须显示,并且任何人都可以看到它。
我需要 javascript/jQuery 解决方案。
谢谢!
I want to make text area, where always is pre written text, and that piece of text is located at the end, and it wouldn't be possible to delete. For example, you write answer here, and at the end, right side of cursor, is text "This is end of my answer".
And when you POST it, it displays your written text and "This is end of my answer" at the end.
I know, that I can attach this text easily after posting it, but it must be displayed, and anyone could see it.
I need javascript/jQuery solution.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
光标右侧的文本在您键入时移动,这确实很烦人且零可用。但是,如果您想要类似的东西,我建议您在文本区域上放置一个带有您想要的文本的背景图像。它将是静态的,没有人能够编辑它,同时总是会看到它。
The text to the right side of the cursor, that moves as you type is really annoying and zero-usable. However, if you want something like that I would suggest putting a background image on the textarea with the text you want. It will be static and none will be able to edit it, and at the same time will always see it.
http://jsfiddle.net/gXvLB/95/
http://jsfiddle.net/gXvLB/95/
您可以使用定位将所需的文本放置在文本区域上。
You can position the required text over textarea using positioning.