Need Help for.
I have one texarea which i have write keyword then press Enter key result with <BR> generate.

$("#chat_box").keydown(function (e){
    if(e.keyCode == 13){                            
    var textval = $("#chat_box").val();
    alert(textval+' you pressed enter ^_^');

    ENTER : Hello,

   OUTPUT: Hello, test (That not correct)

Enter Key works perfectly.
I have also try it Append()
Suggestion me.

Thank you

Member Avatar for diafol

The textarea is probably storing '\n' (newline) not '<br />'.

You could try...

textval = textval.replace(/(\n)+/g, '<br />');
commented: Thank you. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.