In my HTML, I have a text box input. While I am familiar with how to use CSS to set the background color of the entire textbox using background-color
, I am wondering if it is possible to specifically target and change the background color of only the first word typed. For example, if someone enters "hello there," I would like the word 'hello' to appear in orange, while typing "how are you" should make the word 'how' blue.
I was able to style the complete textbox in this JSFiddle using jQuery and CSS. However, I am seeking a way to modify the background color for just the initial word. Is this achievable?