jquery write protection in textarea for wildcards

Posted by Juri on Stack Overflow See other posts from Stack Overflow or by Juri
Published on 2010-04-15T09:53:45Z Indexed on 2010/04/15 10:43 UTC
Read the original article Hit count: 487

Hi everybody.

Does anyone know a possibilty to protect a string-wildcard from changing in a textarea?

HTML:

<textarea name="mail_text" id="mail_text">
{salutation} {recipient},
thanks for your email.
Regards
{username}
</textarea>

I would like to catch when someone tries to change one of the wildcards: {salutation},*{recipient}* and {username}

$("textarea").keyup(function() {
  var val = $(this).val();
  //protect the wildcards
});

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about textarea