I created a javascript code that hides all the different divs from the value that was selected in select
.
$(".filter-target").change(function() {
var target = $(this).val();
if (target == 0) {
$('[data-target]').removeClass('hidden');
return;
}
var self = $('[data-target="'+target+'"]');
$('[data-target]').not(self).toggleClass('hidden');
});
When I select the option that I have displayed the others hide normally, but if I test the others they start to get messy and do not obey the order to "hide all that are not x", the ones that were for appear disappear and come and go. What could be wrong?