Textarea control in php

Posted on 2005-04-18
Last Modified: 2012-08-13
my textarea will display like this

this is the first line

my problem is how to display the hypenatedlines and the text into one color and before the hypenated lines i can type any text ,so how to display the text before the hypenated lines into another color.And how to insert breaks into a textarea?plz
this hypenated lines will be printed using the php code.(this is the first line)text comes from the database.
Question by:lword
    LVL 49

    Expert Comment

    As mentioned. Textarea controls (like any form input control) cannot have multiple font colors.

    You could try using <div contenteditable> and using javascript to copy the innerHTML of this div to an input field before submitting, but this is somewhat tricky.


    Author Comment

    how to use the contenteditable in javascript function?
    LVL 49

    Accepted Solution

    <form method="post" onsubmit="this.content.value=document.getElementById('contentdiv').innerHTML">
      <textarea style="display:none;" name="content" >content here</textarea>
      <div id="contentdiv" contenteditable>content here</div>
      <input type="submit" value="Save" />


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    779 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

    10 Experts available now in Live!

    Get 1:1 Help Now