I created several div
using jQuery where I assign them to the CSS class numero
:
for(...)
textoHTML += "<div class='numero par'>"+sorteado+"</div> <!-- numero par-->\n";
...
textoHTML += "<div class='numero impar'>"+sorteado+"</div> <!-- numero ímpar-->\n";
$( "#quadro" ).html(textoHTML);
I want to be able to click on this div
and retrieve the number drawn.
But I still do not know how to do it, is it with innerHtml
? this
?
However, it looks like the mouse click event is not working:
$( "numero" ).click(function() {
console.log("Clicou no número");
});
With the above code nothing happens. Can it have something to do with the fact that the CSS class numero
of div
is not originally in the DOM?