2
I needed it a little urgent, can you help? I need to filter a list of spans :
<div class="list-group pre-scrollable lista">
<?php for($i = 0; $i < count($ambientes); $i++) { ?>
<span class="list-group-item listaAmbientes" value = '<?php echo
$ambientes[$i]->id_empresa ?>'>
<div class="row">
<div class="col-sm-8 col-md-9">
<?php echo '('.$ambientes[$i]->id.') '.$ambientes[$i]->nome; ?>
</div>
</div>
</span>
<?php } ?>
</div>
The filter needs to be according to the value of a dropdown. This dropdown has id with the company value,
$( "#id_empresa" ).change(function() {
let id_empresa = this.value;
console.log(id_empresa);
filtrarLista(id_empresa);
});
Everything is working, I just need to write this method 'filterList' and update in html, I do not know how to do, if anyone can help me I appreciate!!
Thank you so much, you ran right here, you helped me the hell out!!
– Mateus Alberghini
I would like to filter for more than one attribute, you can do something like this: (?) var selectorShow = "span[value=" + $element.val() + "] && span[code="+ code +"]"; "3"> <div class="Row"> <div class="col-Sm-8 col-Md-9"> Um </div> </div> </span>
– Mateus Alberghini
Yes, you can use Jquery’s Multiple Attribute Selector feature (https://api.jquery.com/multiple-attribute-selector/)
– Jean Gustavo Prates
Right guy, thanks. I found a character that helps too, is the ' '. It’s a startsWith, uses like this: span[value =" + value + "];. It’s very good for research.Maybe you already know, but it’s worth the intention
– Mateus Alberghini