[英]How do I highlight specific words as they are written, with javascript/jquery?
I'm looking for a script whereas words written in my textarea beginning with a "#" is to be highlighted in realtime, as they are written. 我正在寻找一个脚本,而在我的文本区域中以“#”开头的单词在编写时将实时突出显示。 ex: The cutest #animals ever.
例如:有史以来最可爱的动物 。
Any help with this problem is appreciated. 感谢您提供有关此问题的任何帮助。 Thank you.
谢谢。
You can't highlight things in a textarea. 您不能突出显示文本区域中的内容。 So your question is probably moot.
因此,您的问题可能是有争议的。
You could I suppose recreate an input box using a div and capturing keystrokes but it would be a huge amount of work. 您可以假设使用div重新创建一个输入框并捕获击键,但这将是大量工作。
Or you could do like this site does: Type in the textarea, and show the result under it. 或者,您也可以像本网站一样:输入文本区域,并在其下显示结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.