• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

Textarea control in php

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.
0
lword
Asked:
lword
  • 2
1 Solution
 
RoonaanCommented:
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.

-r-
0
 
lwordAuthor Commented:
how to use the contenteditable in javascript function?
0
 
RoonaanCommented:
<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" />
</form>

-r-
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now