views:

63

answers:

2

Hello,

Is it possible to color the user entering code (inside a textarea) using jquery.

Specific texts like <h1>, <b> etc should be colored or highlighted.

this helps to distinguish the opening closing tags.

Please help

+2  A: 

No.
Text blocks in <textarea> elements cannot be formatted.

You need to use a ContentEditable element.
Try CodeMirror.

SLaks
yes i want like CodeMirror ! but it uses huge resources. you really understood my question !
Aakash Chakravarthy
SLaks
@thanks Slaks . anyway searching with jquery !
Aakash Chakravarthy
+2  A: 

jQuery will only be able to edit the styles of elements that can be styled using CSS. It is not possible to edit colours inside an input element in this way.

You might want to check out

SyntaxHighlighter

http://alexgorbatchev.com/wiki/SyntaxHighlighter

calumbrodie
That's not an editor.
SLaks
You're right - Sorry I should have given this more thought. SyntaxHighlighter cannot be used to edit code.
calumbrodie