By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

Insertion of BB codes

P: 77
Hi, I'm pretty new to javascript, but I managed to make a simple BB Code script which allows me to paste stuff like [b.] text [/b.] (without the . )into my textarea by button.
The problem is that this will always get inserted at the bottom/last in the text field, and not where the mouse is focused.

How can I make it paste these codes where my mouse is targeted?
Mar 7 '11 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027

P: 77
Thank you, I found a solution in one of those threads.
However, as my BB codes are repasted, the original, selected text is also repasted. so it looks like this:
[b.] hello [/b.] hello
instead of:
[b.] hello [/b.]

Is there any easy way to remove the selected text from a textarea? :)
Mar 7 '11 #3

P: 77
Never mind, I solved it............. :)
Thanks
Mar 8 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.