When I press the return key to start a new line for the post, the result auto-ignore the return key. I wondered what the most common way of making the output actually starts wi
Im replying to this because your other question was marked duplicate.
By replacing 2 of your It is able to capture the space by changing your script to capture the textarea with the method .val() To have it printed with the line break, in your commenttest.php, insert this before you echo, which is what you have tried but didnt work from your duplicate post or recommended from an answer.
var txt = $("textarea#comment_box").val();
if(txt){
$.post("commenttest.php", {txt: txt}, function(result){
$("div[name=commentsubmit]").prepend(result);
$("textarea#comment_box").val();
});
}
$comment = nl2br($comment);