I make a call Ajax
and this call returns me some data. I need to pass a data of descrição
, it is a string with a text, however to pass this data in modal I am using data-
and for this I need to convert to text. I'm looking for a method to be able to format this descricao
within the modal. Removing  
and putting <br>
in place.
How the date is being made
var descricao = $(json[i].descricao).text(); //Converter para texto, pois ela vem com as tags html
<div class="card opModalGaleria" id="'+json[i].seq_membro_galeria+'" data-toggle="modal" data-target="#modalGaleria" data-descricao="'+descricao+'">
And then at the time of displaying I am not able to replace  
with <br>
to format correctly in modal to descrição
.
$('#modalGaleria').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var descricao = button.data('descricao')
var descricaoFormatada = descricao.replace(/ /g,"<br/>")
var modal = $(this)
modal.find('#descricaoModal').text(descricaoFormatada)
})