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

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.