Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts

    highlight text, click on a button and add bbCode in textarea

    Hi

    first steps in the world of javascript.
    You can guess that it's still a dark world to me.

    Here is what I am trying to do.

    I have a textarea and a little image (the common 'B' for Bold). I would like, as the title of this thread suggests, that when I click on the image, the highlighted texts become surrounded by these two custom bbCode: [ b ]text highlighted[ /b ] (extra spaces have been added so that vbulletin does not actually interpret the bbcode ).
    Is that hard to achieve? Would someone show me how to do this?
    That would be really nice.

    Here is my actual code (just the fundations of the page). You will find the gif in question in the attachement part of this thread. I am looking forward to learning how to do this.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>playing with the textarea</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <script type=text/javascript>
    
    </script>
    
    </head>
    <body>
    
    
    <form name="replace" id="replace" action="" method="">
    
       <img height=20 alt=Bold src="bold.gif" width=21>
       <br />
       <textarea name="test" rows="20" cols="35"></textarea>
       <br />
       <input type="submit" value="Submit" />
    
    </form>
    
    </body>
    </html>
    thanks in advance for your help
    Attached Images Attached Images  

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This has been asked and answered several times...
    Try searching the forum for bbCode in* textarea....

  • #3
    Regular Coder
    Join Date
    Aug 2003
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Willy Duitt
    This has been asked and answered several times...
    Try searching the forum for bbCode in* textarea....
    Hi
    thanks for your reply.
    I tried but couldn't find the answer. I always end up in the middle of already advanced projects, therefore I don't get nothing to the discussion that is going on.
    Do you have a link to a thread that is starting it from scratch?
    Basically, I just need to get bold, italic and a few other edition tools to work,


  •  

    Posting Permissions

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