Jump to content

Add text to textarea.


Cod-nes
 Share

Recommended Posts

Find what the user has highlighted and then do something like this:
<html><body><textarea id="text">Maybe this works...</textarea><script type="text/javascript">function emboldenSubstring(string, start, end){	var before = string.substring(0, start);	var substring = string.substring(start, end);	var after = string.substring(end);	return before + '[b]' + substring + '[/b]' + after;}var area = document.getElementById('text');area.value = emboldenSubstring(area.value, 6, 10);</script></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...