Edit to add: I first asked about a textarea - I had a feeling it just wasn't possible with a textarea by its nature. Could I do this with a contenteditable div?
Within a contenteditable div, when the user enters %TEST% I would like to add a span with a class around %TEST% to be able to add styling to it.
It runs if %TEST% is in the html, but I need it to run if %TEST% is typed in by the user.
<div contenteditable="true" class="myEntry">We're happy you're here, %TEST%. Let's get started.</div>
using jquery I have:
$('.myEntry).each(function () {
var original = $(this).text();
var new_version = original.split('%TEST%').join('<span class="stylizeMe">Test</span>');
$(this).html(new_version)
});