Imagine the following code below:
<a id="link" href="/nova_pagina.php">
<div id="abrir-nova-pagina" >Linha_1</div>
<div id="nao-abrir-nova-pagina" >Linha_2</div>
<a/>
I want the # link element to work when I click on the first div and open a new page and I do not want the link to work when I click on the second div.
How can I do this?
I have seen some examples with jQuery using the stopPropagation () method but it did not work.
See below:
$('a#link').on('click', function(event){
event.stopPropagation();
});
$('#nao-abrir-nova-pagina').on('click', function(event){
alert('Funcionou!')
});
What did I do wrong?