Jump to content

Add text to textarea.


Cod-nes

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...