0
Hello! I am trying to implement Divs on a website when the user clicks on an image with a + .
These Divs themselves are a form of transition to other pages, however when added by javascript their function stops working.
<p id="adicionar_mais1"><img src="Imagens/Mais.jpg" onclick="Adicionar1()" id="Mais"></p>
function Adicionar1() {
var primeirasoma = " <div onclick='location.href='Artigo19.html''><p><img src='Fotografias/foto86.jpg'></p><p class='topico space'><b>Titulo</b> 12.02.2020</p><p class='nomeart'>SEGUNDOTITULO</p><p class='descri'>TEXTO TEXTO</p></div>";
;
document.getElementById("adicionar_mais1").innerHTML =
primeirasoma;
}
</script>
I think the problem is that I had to change the "" to '' and that changed the location href, but I don’t know how else to add this kind of elements to the page.
Does anyone know what I should change in my code to make it work, or if possible another easier method if there is, since I will have to add several Ivs at once.
Thank you!!