Can a user add a link to a text area by clicking a button?

Posted on 2008-11-13
Last Modified: 2012-05-05
I have a form which updates to my database. I want to give the user the option to turn something into a link by highlighting the text and then clicking a button which will open a new window where they type the link address. When they close the window the highlighted text should be turned into a link. An example is Yahoo mail or most other mail programs where you turn text into a link. Can anyone either explain how I do this or point me in the right direction? Thanks.
Question by:elliottbenzle
    LVL 20

    Expert Comment

    LVL 8

    Accepted Solution

    Check this out

    Use prompt to take the url from the user

    Also you can try other popular wysiwyg editor such as tinymce and fckeditor.

    As they are open source you can look at their code also, to find your solution. The most simplistic action you will find at:
    LVL 54

    Expert Comment

    In case it isn't obvious from the posts above you need to use something else to do it.  A textarea tag can't do this.  With script you might get selected text and even modify it but the textarea can't show a hyperlink; it is just basic text.
    There area a number of suggestions above for replacements that will do it.  There are even more available.  Another good one is at .  There is also some good info on more at .  The one at the bottom of the page is an old, good, reliable one.  If you want to see a search result with a number of others you can look at .
    Let me know if you have a question about any of this or need more info.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Controlling which port to download from 4 51
    two submit buttons one form 15 61
    sumHeights2  challenge 7 51
    SQL400 max size 5 34
    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now