Type word "want" and change color automatically in javascript

Good afternoon guys, how are you? I have a question and if you could help me I would be grateful
I have html, js and css code below that when I type “I want”, I want it to automatically change the color of the text in the part I type, instead of showing text on the bottom line, as shown in the image.



#text {
border: 1px dashed #CCC;
min-height: 30px;
.color-one {
background-color: gray;
color: white;
.color-two {
background-color: salmon;
color: white;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.