Federico Zancan
Federico Zancan

Reputation: 4884

php syntax coloring with HTML and jQuery

is it possible to have a <textarea> widget to support php syntax coloring with jQuery?

In short, I'd need to colorize code while the user is typing it into the textarea.

It would be great if line numbers were shown too, but it is not strictly necessary.

Any other framework would eventually be welcome.

Thanks.

Upvotes: 1

Views: 318

Answers (2)

hcb
hcb

Reputation: 8347

You can change the color of the textarea in the onchange with:

onchange="$(this).css('color','#00FF00')"

Upvotes: 0

SirDarius
SirDarius

Reputation: 42869

There's a neat javascript library called CodeMirror that allows to do that.

There's the option to display line numbers, and works in real time, for a variety of languages, including PHP.

It is not related to and does not depend on jQuery.

Upvotes: 4

Related Questions