views:

1885

answers:

4

Hi,

I'm trying to find an editor (or some simple JavaScript - preferably jQuery) that will allow me to edit the contents of a textarea.

I don't want it to be rich text or WYSIWYG; I just want to be able to select a bit of text, click a button/link and have some simple HTML tags that I define put either side of the highlighted text. I also want to be able to insert empty tags at the cursor if no text is selected in the textarea. Essentially, what I'm looking for is similar to the Stack Overflow text editor, but for custom HTML, not Markdown.

What options are there that I could use?

Thanks in advance.

+1  A: 

Would something like this fit the bill? I think it just uses document.selection to identify where to insert the markup.

Phil Jenkins
+2  A: 

BUEditor is a passing slick editor for what you describe. It was built for use with Drupal but the instructions for non-Drupal usage seem fairly clear.

Grayside
Nice one. Thanks for the link.
Philip Morton
A: 

I've made the one I created for my CMS freely available Byrst XHTML Editor

+2  A: 

Take a look at Markitup - it's a jQuery-based text-only markup editor which is quite customisable.

nickf