Enable New Line in Textarea - Jquery Append

Hassan Sardar

I am using append function. Function is working fine. Everything is ok.

But when is press some ENTERS (Break Line) in Textarea. It appears in the form of New Lines in Textarea but when it appends to HTML it doesnt appears in the Form of New Lines.

Take a Quick Look at this Image:

enter image description here

Here is my DEMO:

http://jsfiddle.net/YRKxR/17/

Here is my Jquery Code Or you can simply visit my JsFiddle DEMO:

$('.add_more').click(function()
                     {
                        var description = $('#description').val();
                        $(".append_data").append('<tr><td>'+description+'</td></tr>');
                     });
Dev

TRy this demo http://jsfiddle.net/YRKxR/18/

white-space :pre is required

$('.add_more').click(function()
                     {
                        var description = $('#description').val();
                         $(".append_data").append('<tr><td style="white-space:pre;">'+description+'</td></tr>');
                     });

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related