DanRz Posted January 23, 2023 Share Posted January 23, 2023 (edited) Hey, I have the following jQuery line... it gets the object noteInfo and displays it into a modal. Works great! However, it doesn't seem to output the line breaks, I just get a big chunk of text. Any ideas would be amazing. jQuery Line $("#viewNoteModal .modal-body").html(obj.noteInfo); Console output noteInfo: "This is a note\r↵Sent: 26 September 2022 12:56" Dan EDIT - I have worked this out. It was a bug in the code that outputted the text. Edited January 23, 2023 by DanRz Fixed myself Quote Link to comment https://forums.phpfreaks.com/topic/315831-jquery-html-not-outputting-line-breaks/ Share on other sites More sharing options...
Barand Posted January 23, 2023 Share Posted January 23, 2023 HTML ignore whitespace. Try .text() instead of .html(). Or substitute <br> for \r Quote Link to comment https://forums.phpfreaks.com/topic/315831-jquery-html-not-outputting-line-breaks/#findComment-1604958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.