Hello, I am currently adding BBCode to my website, and I posted a while ago in this forum for a script that would add tags to my textarea when clicking an BBcode image. But my next problem now is that I need those tags to appear around selected text and at the mouse cursor if no text is selected. Currently all it does is just add the tags at the end of your sentence if you've written something in the textarea.
Here is the code I use:
var ta = document.getElementById("my_ta");
ta.value += txt;
window.onload = function()