|
General Details
|
|
JavaScript
|
|
Posted 118 Days Ago
|
|
430 Views
|
|
Received 2 Ratings
|
|
Rich Text Editor (minimal & progressive enhancement)
Description
Will convert any textarea tag in to a richtext box. If no javascript is enabled, the plain textarea is used otherwise it converts it to a richtext box. On form submission the content in the richtext area is converted back to the textarea and the form is submitted as if there was no rich text box at all!
This is just a small framework, the minimal requirement to render a rich text box. It also works on Safari, Opera, FireFox and IE.
Kind regards,
Scott
P.S. i added a single line of PHP that will show the output of submitting the form.
Technical
To use, all you have to do to dynamically convert a textarea in to a richtext box is wrap any textarea tag with this:
<span rel='richtext' width='100%' style="cursor:text;">
<iframe class='richtext' style='display:none;'></iframe>
<TEXTAREA HERE>
</span>
For example:
<span rel='richtext' width='100%' style="cursor:text;">
<iframe class='richtext' style='display:none;'></iframe>
<textarea style='width:100%;height:200px;' name='sent'>hello<a>dsg hgdfjhgfhfda</textarea>
</span>
Theres no need to change any of your server side code because the content is sent normally within a forum tag using the textarea properties such as the field name! ;-) Put the default text you want in the richtext editor etc between the textarea tags as normal.
Source Code
Comments
| Please login to post comments. |
|
|
Go ahead, do what ya want with it. As a thanks though, just leave a link back to coder profile ;-)
Kind regards,
Scott
|
|
|
Great work i've been looking for this so clients can easily change and update pages, hope you don't mind me modifying and updating :).
|
|
|
That's just ... awesome. I love it.
|
|
|
Sweet. So, HTML works, awesome.
|
|
|
On IE the bold, italic, underline, etc shortcuts auto work... but in that example i was on firefox and i did that by putting default text in the textarea like:
<textarea>hello <b>mate</b>, how are you?</textarea>
Where "mate" would then be bold when the rich text editor loads.
Kind regards,
Scott
|
|
|
Very cool. I think I will add this to my 'employee portal' for my clients.
I see in the screen shot the text is bolded. Is this done by hot keys (Cntrl-B) ??
If so, that would be awesome.
|
More "JavaScript" Source Codes By This Author
Recently Posted "JavaScript" Source Codes
Recently Rated "JavaScript" Source Codes
|