1
Guys, I’m trying to change an image at the click of the button and I’m not getting it, jquery returns me this error:
I’m trying to make the exchange using the date attribute.
My Jquery code:
$('#botao_troca_imagem').on('click',function() {
jQuery().data('imagem').attr("src", "/public/default/images/marker.png");
$("#botao_troca_imagem").remove();
});
My HTML code:
<figure>
<img data-imagem="troca_imagem" src="/public/default/images/mapa-google.jpg">
<figcaption>
<button id="botao_troca_imagem" role="button">Mostrar mapa</button>
</figcaption>
</figure>
It worked, thank you very much!
– Giovanni Sertorio