I am facing a seemingly straightforward issue, but I worry that it may be too complex for me to handle on my own. My goal is to incorporate a textarea into a webpage where users can input HTML code, click a button, and have the interpreted HTML displayed in a div next to the code, similar to the "try it" sections on w3schools.
Currently, I have most of the functionality in place and it works almost as expected - the code renders correctly when the button is pressed. The next challenge is to add syntax highlighting to the textarea so that the text changes color based on the tag or attribute typed, mimicking the behavior of notepad++ with blue text for tags and red for attributes, for example.
I believe the solution involves parsing the content of the textarea word by word, comparing against all possible tags and attributes, and then updating the textarea with colored text. It seems like this may not be achievable with a standard textarea, potentially requiring a specialized applet instead. Can anyone suggest the most efficient approach to achieving this? While I am close to finishing my computer science degree, my web programming knowledge is limited, although I have begun exploring jquery and jsp, along with some experience in HTML/CSS/Javascript.