0

Am a newbee to javascript but have plenty of experience in VB, C, and even 86 assembler. Maybe I am trying to do the impossible in porting a VB app to js here. Basically, I need to change the color for only part of the string in an input element. Here is the problem:

A function takes an entered input box text field, and processes it first to see if it is in conformity to a set of requirements. If part of that string is not in conformity, I would like to in some way highlight that part in the input field. For instance, maybe I can send back the string to the input element (eg using the value attribute) but with some highlighting for that part, such as changing its text color or background color. Is this possible in js?

krasnit
  • 1
  • 1
  • I don't think you can achieve this with plain ``, a custom component has to be created for the purpose of partial highlight. Perhaps, there is already a custom component fits your need from some JS frameworks. – frogcoder Aug 27 '21 at 15:12

1 Answers1

0

I'm not sure whether you can change colors of partial text in a simple text box. But what you're trying to do is certainly possible with this: https://editorjs.io/
The example on the homepage shows you how.
I hope this is a possibility for you and not too heavy for your purpose.

kalyanswaroop
  • 403
  • 4
  • 5