Learn how to a build a cloud-first strategyRegister Now


Textarea control in php

Posted on 2005-04-18
Medium Priority
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
  • 2
LVL 49

Expert Comment

ID: 13804610
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

ID: 13805080
how to use the contenteditable in javascript function?
LVL 49

Accepted Solution

Roonaan earned 2000 total points
ID: 13805857
<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" />


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Starting up a Project

810 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