I’ll risk an adaptation of the code that may be what you wish. Following the line of Netinho’s reply, I believe I can fix it. If this is it, the credits are from Netinho, because I just adapted his code.
var recebeMensagem = []
var mensagemBot = '<div class="bot_mensagens">' + recebeMensagem + '</div>';
var conteudoHtml = '';
conteudoHtml = $('.recebe_as_mensagens').html();
recebeMensagem += 'Olá';
recebeMensagem += 'Tudo bem?';
recebeMensagem += 'Tchau';
conteudoHtml += mensagemBot;
$('.recebe_as_mensagens').html(conteudoHtml);
$(".bot_mensagens").text(recebeMensagem)
Here you have a vector in Javascript recebeMensagem = []
, now just throw the items into the vector and the messages will be stored in different positions.
Following the same logic, you can scan your array and display the results as follows:
for(var i = 0; i < recebeMensagem.length; i++){
conteudoHtml = mensagemBot;
$('.recebe_as_mensagens').html(conteudoHtml);
$(".bot_mensagens").text(recebeMensagem)
}
See on Jsfiddle
I hope it helps, I just tried to fit the logic, I don’t have much experience with Javascript. Hugs!
You get these messages like?
– sant0will