When a code is typed in like ^1 in a textarea i want the font color of any text after that code to be changed to whatever color the ^1 is assigned to,
As of now i have the following:
<form method="post" action="index.php">
<textarea id="text" onkeypressed="changecolor()"></textarea>
<input type="submit" value="Add">
</form>
javascript:
function changecolor() { //code here }
so basically when i type in ^1 and the color blue is assigned to that code, the text after that code will be in the color blue, but when a second code is typed in; example ^2 the text after that will be the color that is assigned to that code,
I know very well how to insert data into a database, but i need to beable to find a way of getting the raw data; i.e the data that was orginally typed into the textarea with the codes like ^1 and ^2
Help is really appreciated!
You cant target specific fragments of text in a textarea. What you want to do can’t be done of my knowing, unless you monitor its content and add an abstract div layer to output styled html from it.
Many wysiwyg text editors do it like this, or use the ‘contenteditable’ attribute to allow html editing in modern browsers…
You can start like this:
html: