SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WYSIWYG editor controls on <textarea>

    Been searching online for a while and I can't seem to find any decent solutions that work in both Firefox and IE --> basically I want to write a very simple WYSIWYG text editor where a user can highlight a word, click a "B" button and it adds bold tags around it.

    Anybody have any idea how to accomplish this seemingly easy task? I've looked at the source code for various open source apps (like Wordpress and phpBB) but the code in both of these is gargantuan and fairly difficult to follow with all the includes and custom objects, functions etc.

    It's clearly possible... anybody know how to do it?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

    Problem solved with a few lines of code between original post and now.

    Now, onto the next issue (may post in a thread of it's own...):

    When a user clicks the "B" (bold) button, I'd like the caret/text position/whatever to sit between the two tags so the user can instantly type the content of the bold text instead of having to click between the tags first.

    Also, is it possible to prevent whitespace from being selected when a user double-clicks a word in a textarea field? For example, clicking the word "hello" would actually select "hello " (whitespace character at the end of the string).

    Thanks in advance!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •