How can I filter a listgroup of span?
I need to filter a listgroup like this:
<div class="list-group pre-scrollable list">
<?php for($i = 0; $i < count($places); $i++) { ?>
<span class="list-group-item listPlaces" value = '<?php echo $places[$i]->id_company ?>'>
<div class="row">
<div class="col-sm-8 col-md-9"><?php echo '('.$places[$i]->id.') '.$places[$i]->name; ?></div>
</div>
</div>
</span>
<?php } ?>
</div>
And I need to filter based on "when this dropdown changes" (the dropdown has an id of id_company that changes for each selection):
$( "#id_company" ).change(function() {
let id_company = this.value;
console.log(id_company);
filterSpans(id_company);
});
How do i write this method "filterSpans"?