1
Good evening, I have a modal to display information about a product, until then I can display this data with this script
$('a[data-target="#saberModal"]').on('click', function (e) {
e.preventDefault();
var nome = $(this).data('nome');
var descricao = $(this).data('descricao');
$('div.textoSaber').html(nome + descricao);
$('#saberModal').modal('show');
return false;
});
Only that the name is stuck to the description, I would like to know how to format this element in my html so that they are displayed correctly. I tried to change the script this way.
$('a[data-target="#saberModal"]').on('click', function (e) {
e.preventDefault();
var nome = $(this).data('nome');
var descricao = $(this).data('descricao');
$('div.textoSaber').html(nome);
$('div.descricao').html(descricao);
$('#saberModal').modal('show');
return false;
});
but only the name, the description is not displayed.
Do you have any error screenshots? Or better, you can post the full code to a Jsbin, Jsfiddle or Codepen?
– Douglas Garrido