0

I'm developing my own forum software, and i am now doing the editor. Well i want to make some tags ofc, like [b] and [i].

How can i do that? Well, i found this thread: Insert text into textarea with jQuery

and used this:

$('a').click(function() //this will apply to all anchor tags
{ 
   $('#area').val($('#area').val()+'[b][/b]'); 
})

But i also want to point just right between the tags, between the [b] and the [/b], how can i do that?

Community
  • 1
  • 1
Thew
  • 15,789
  • 18
  • 59
  • 100

2 Answers2

1

See this question: jQuery Set Cursor Position in Text Area

/edit: Sorry this was already answered in the comments.

Community
  • 1
  • 1
Alp
  • 29,274
  • 27
  • 120
  • 198
0

If this is out of scope, please just say it, but you can also select text and wrap them in the [b][/b] tags by using the JQuery selectedText plugin. I think it might be helpful for your final product (otherwise, for your question, the previous question as mentioned by Billy Moon is sufficient)

Andrew Jackman
  • 13,781
  • 7
  • 35
  • 44
  • Ahh, I am really sorry, I just googled the name (I came across it a while ago and can read both languages so I tend not to think about what language things are in :S) – Andrew Jackman Mar 26 '11 at 14:34
  • Here: [http://squareflower.de/downloads/jquery/selectedtext/beispiele/](http://squareflower.de/downloads/jquery/selectedtext/beispiele/) all the examples are in "programming" so it doesn't matter what language the site is in (the actual code contains English, which I think is weird...) – Andrew Jackman Mar 26 '11 at 14:36