I have a <textarea> which I want to use as a editing panel similar to the ones found in most bulletin boards and forums (even like the one in here). There has to be a 'bold text' button which should bold the currently selected/highlighted text in the <textarea>.
How do I do so using javascript.
For example if the following belongs in the <body>-
<textarea id="txtArea">Some text here.</textarea>
<input type="button" id="btnCmd" onclick="boldthis('txtArea');" value="Bold">
How do I complete the javascript code function boldthis(elementid){} so I can do
at least collect the selected text in <textarea id="txtArea">?
You may or may not use the example I used to describe your explaination, as long as I understand the logic. Thanks for reading.