1
How can I do to if there is value occur a None display on all Divs with car?
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script>
$(document).ready(function() {
$(".acionador").click(function() {
if($(".texto").html().indexOf("carro")!=-1) {
// fazer um hide em todas as divs que contem carro
}
});
});
</script>
<div class="acionador" style="background: black; color: white;">acionador</div>
<div class="texto"> texo carro </div>
<div class="texto"> texo carro </div>
<div class="texto"> texo moto </div>
Great! I didn’t know this contains :)
– Josimara
@Josimara despite not having the
contains
listed, here is a list of 30 useful selectors.– Sorack
as specific to div by class or id ai?
– Josimara
@Josimara by class you use the
.
, as in the examplediv.texto
. Forid
you use the#
, getting something likediv#texto1
– Sorack
Sorack, it’s been so long...
– Miguel
@Miguel hahaha was dating, so there was no time. Now I took a kick in the ass and more available
– Sorack