-1
Hi, I created a chat on my website using Firebase. But I don’t know how to make this message be saved along with line breaking.
In the image above I am using the textarea to write the message.
More after sending the message she does not do the line break as shown in the photo below.
This is my code that saves the message in the Firebase database.
$("#send_button").on('click', function () {
var user = firebase.auth().currentUser;
var displayName = user.displayName;
var photoURL = user.photoURL;
var mess = $("#msg").val();
var date = formatAMPM(new Date());
firebase.database().ref('chat/' + Date.now()).set({
name: displayName,
photo: photoURL,
message: mess,
date_and_time: date
});
var element = document.getElementById("scroll-chat");
element.scrollTop = element.scrollHeight;
$("#msg").val("");
});
This answers your question? How to insert word break into textarea in inserted text via jquery/javascript?
– renatomt
I’ve seen this example before but it didn’t work for me.
– Vanderclin Rocha