Jquery dropdown multiple filter
Hello looking for some help with jquery multiple filter. I have done some filter, where I can show data from select option, and hide which value not selected. But its not working properly, when I do select for 3 different options, It shows me also incorrect data. Example I have selected Non active user, and when I select user position Programmer its shows me all programmerms even they are not active, here is my script, maybe someone can help to update it?
function filterText()
{
var rex = new RegExp($('#filterText').val());
if(rex =="/all/"){clearFilter()}else{
$('.content').hide();
$('.content').filter(function() {
return rex.test($(this).text());
}).show();
}
}
function clearFilter()
{
$('.filterText').val('');
$('.filterText2').val('');
$('.filterText3').val('');
$('.filterText4').val('');
$('.content').show();
}
function filterText2() {
var rex2 = new RegExp($('#filterText2').val());
if (rex2 == "/all/") {
clearFilter()
} else {
$('.content').hide();
$('.content').filter(function () {
return rex2.test($(this).text());
}).show();
}
}
function filterText3() {
var rex3 = new RegExp($('#filterText3').val());
if (rex3 == "/all/") {
clearFilter()
} else {
$('.content').hide();
$('.content').filter(function () {
return rex3.test($(this).text());
}).show();
}
}
function filterText4() {
var rex4 = new RegExp($('#filterText4').val());
if (rex4 == "/all/") {
clearFilter()
} else {
$('.content').hide();
$('.content').filter(function () {
return rex4.test($(this).text());
}).show();
}
}