tags:

views:

35

answers:

2

I have a textarea in a form that will eventually be an email form. Using Jquery I have loaded a signature file and want to display it in the text area. I have the file but using .html displays nothing and using val(data) produces the code on my box . Can anyone offer any help please

    function loadedData(data) {
$('#mail_body').val(data)

}

$.get('../signature/sig1.htm', loadedData);
A: 

textarea elements are not rich-text editors. They can only display plain text. To have a WYSIWYG editor, try TinyMCE.

Delan Azabani
+1  A: 

You cannot put html in a textarea. But you can parse it with jQuery before putting it there.

function loadedData(data) {
   var sig = $("#mysig", data);
   $('#mail_body').val(sig);

}

$.get('../signature/sig1.htm', loadedData);

Or you should use some wysiwyg to add HTML capabilities to your edit box:

http://ckeditor.com/

http://tinymce.moxiecode.com/

Epeli