0
$('a[rel=modal]').click( function(){
var id = $(this).attr('href');
var a1 = [];
for (var i = 0; i < id.length; i++) {
a1[i] = (id[i+1]);
}
var a2 = a1.join('');
var idTime = parseInt(a2);
modaisTime= $('#modaisTime');
var t = JSON.parse(localStorage.getItem('Times'));
modaisTime.html('');
modaisTime.append('<div id="'+ idTime +'" class="modal modal-fixed-footer"><div class="modal-content"><h4 class="center-align">Time</h4><li class="divider1"></li><p class="flow-text col s12 m6">Nome: '+t[idTime].nome+'</p><p class="flow-text col s12 m6">CNPJ: '+t[idTime].c+'</p><p class="flow-text col s12 m6">Responsável: '+t[idTime].nomeR+'</p><p class="flow-text col s12 m6">CPF: '+t[idTime].cpfR+'</p></div><div class="modal-footer"><button id="editar" class="modal-action waves-effect waves-red btn-flat" type="button" onclick="editar('+idTime+')">Editar</button></div></div></div>');
$(id).toggle();
});
<div id="mostrarTimes">
<h5 class="col s7">Flamengo</h5>
<a href="#0" rel="modal"></a>
</div>
<div id="modaisTime">
The thing is, I wanted to do this already showing the modal with href, but I can’t, hold on would know how to do after the modal be created it open?
Which Modal are you wearing? Bootstrap?
– Sergio
@Localhost, that kind of improvements can hide the problem from the question, so it is better not to. If the problem is the lack of this
>
it will be difficult for anyone to discover since the question no longer reflects it.– Sergio
@Sergio, oh yes, I understand. Shall I undo it then? It’s just that I thought he forgot at the time of the typing, just like the rest of the div, which seems to be missing...
– LocalHost
@Localhost we leave until the AP appears here and explain the question better. The intention is clear! :)
– Sergio
Test this by using bootstrap: https://www.w3schools.com/bootstrap/bootstrap_ref_js_modal.asp
– Paulo Junior