I've created code that works similar to the buttons when posting in them forum (Quote, Text, PHP Code, etc). The problem is that once i've clicked on it and remove the newly created text from the textarea, i cannot get it displayed again unless i refresh the page. This is with the following browsers : Firefox, Chrome and Safari. In IE7 it works as i would like it to, each click (without refreshing the page) displays the text (after i've removed the created text). Herewith my code :
Html
Code: Select all
<form action="" method="post" />
<input type="button" name="btn" value="PHP" onclick="codeTags('comment');" />
<textarea id="comment" rows="7" cols="30" /></textarea>
<input type="submit" name="submit" value="Submit" />
And the javascript
Code: Select all
function codeTags(p)
{
theElement = document.getElementById(p);
theElement.innerHTML = '[code][/code]';
}