1
I’m looking to replace the tag <a>
for <span>
.
I tried to do it like this, but it doesn’t work:
$(document).ready(function() {
$('#lista-noticias .box-noticia .conteudo-noticia').each(function() {
alert("teste");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="lista-noticias">
<div class="box-noticia">
<div class="conteudo-noticia">
<a href="qualquer.coisa1.html">
</div>
</div>
<div class="box-noticia">
<div class="conteudo-noticia">
<a href="qualquer.coisa2.html">
</div>
</div>
<div class="box-noticia">
<div class="conteudo-noticia">
<a href="qualquer.coisa3.html">
</div>
</div>
<div class="box-noticia">
<div class="conteudo-noticia">
<a href="qualquer.coisa4.html">
</div>
</div>
</div>
Try to close your tags
<a>
to see if it doesn’t work -</a>
– Pedro Camara Junior
How many alerts does the code give?
– Rodrigo Rigotti
@Brunodm, I turned your code into a snippet, and it ran without modification.
– Tobias Mesquita
There is no Alert. No each, I need to put the path of all tags ? Or could I put it like this: $('#newslist . contentudo-noticia'). each(Function() {...
– Bruno