Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 535551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:43:43+00:00 2026-05-13T09:43:43+00:00

I have some div´s in my page (build with php+jquery) and I want to

  • 0

I have some div´s in my page (build with php+jquery) and I want to filter them according to their attributes (if there´s more than 1 attribute filtering, than it will narrow down the search).
The div´s look like this:

<div id="solicitacoes">
    <div id='1' title='Mike' status='18' analista='23'>Whatever content 1</div>
    <div id='2' title='John' status='16' analista='46'>Whatever content 2</div>
    <div id='3' title='Tom' status='2' analista='49'>Whatever content 3</div>
    <div id='4' title='Mike' status='4' analista='23'>Whatever content 4</div>
    <div id='5' title='Kate' status='3' analista='32'>Whatever content 5</div>
    <div id='6' title='Steve' status='1' analista='14'>Whatever content 6</div>
</div>

Then, I have a form to filter the div´s attributes:

<div id="filtros">
<form id="filtroSolicitacoes" type="post" name="filtroSolicitacoes">
Protocolo: <input type="text" name="filtroProtocolo" id="filtroProtocolo" size="5"/>
Solicitante: <input type="text" name="filtroSolicitante" id="filtroSolicitante" size="10"/>
Status: 
<select name="filtroStatus" id="filtroStatus">
<option value="0">-- Selecione Status--</option>
<option value="3">Aguardando Aprova&ccedil;&atilde;o</option>
<option value="18">Encaminhado</option>
<option value="2">Iniciado</option>
<option value="1">N&atilde;o Iniciado</option>
<option value="4">Pendente de Esclarecimento</option>
<option value="16">Reiniciado</option>
<option value="6">Reprovado</option>
</select>
Analista: 
<select name="filtroAnalista" id="filtroAnalista">
    <option value="23">Robert</option>
    <option value="46">Allan</option>
    <option value="49">Edward</option>
    <option value="32">Jake</option>
    <option value="14">Stella</option>
</select>
<button type="submit" id="filtrar" style="float:right; margin-right:10px">:: Filtrar ::</button>
</form>
</div>

Now, I´ve alredy done most of the Jquery part and the filter is working —> But I want to NARROW DOWN the search if there´s more than 1 filtering attribute, NOT to concatenate it, and that´s what´s happening with my code
bellow:

$("#filtroSolicitacoes").submit(function() {
    $("#solicitacoes > div").show();
    var filtroProtocolo = $("#filtroProtocolo").val();
    var filtroSolicitante = $("#filtroSolicitante").val().toUpperCase();
    var filtroStatus = $("#filtroStatus").val();
    var filtroAnalista = $("#filtroAnalista").val();
    var filtroResultado = $("#filtroResultado:checked").length;

    var filtros = "[id=filtros]";

    if(filtroStatus !== "0"){
        filtros +=",[status='"+filtroStatus+"']";
    }
    if(filtroProtocolo !== ""){
        filtros +=",[id='"+filtroProtocolo+"']";
    }
    if(filtroSolicitante !== ""){
        filtros +=",[title*='"+filtroSolicitante+"']";
    }
    if(filtroAnalista !== "0"){
        filtros +=",[analista='"+filtroAnalista+"']";
    }

    if(filtros !== "[id=filtros]"){
        $("#solicitacoes > div:not("+filtros+")").hide();
    }
    return false;
});

I´ve tried to use “&&” instead of “,” in

filtros +=",[analista='"+filtroAnalista+"']";

But it didn´t work.

any ideas?

PS: Sorry for my poor English, I´m brazilian 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:43:43+00:00Added an answer on May 13, 2026 at 9:43 am

    You should use the filter() function:

    var filteredList = elements
                          .filter("[status=status1]")
                          .filter("[title*=something]");
    // and so on
    

    In your example:

    $("#filtroSolicitacoes").submit(function() {
        $("#solicitacoes > div").show();
        var filtroProtocolo = $("#filtroProtocolo").val();
        var filtroSolicitante = $("#filtroSolicitante").val().toUpperCase();
        var filtroStatus = $("#filtroStatus").val();
        var filtroAnalista = $("#filtroAnalista").val();
        var filtroResultado = $("#filtroResultado:checked").length;
    
        var elements = $("[id=filtros]");
    
        if(filtroStatus !== "0"){
            elements = elements.filter("[status='"+filtroStatus+"']");
        }
        if(filtroProtocolo !== ""){
            elements = elements.filter("[id='"+filtroProtocolo+"']");
        }
    
        // and so on
    
        $("#solicitatcoes > div").not(elements).hide();
    
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help! I have some form elements in a div on a page: <div
I have a div (sub area of page with scroll bar) that has some
I have a page with some controls, usercontrols etc. when I change a div
In my case, i have some div and img tags. I am applying draggable
I have some problems resizing a div with ID mask which I use to
I have some Html like: <div id=adiv> <ul> <li data-id=3>Cat</li> <li data-id=4>Dog</li> </ul> </div>
I have some divs: <div class=A>Target</div> <div class=A B>NotMyTarget</div> <div class=A C>NotMyTarget</div> <div class=A
I have some html snippet <div id=title>This is title<span id=close>X<span><div> The width of this
I have some html like the following: <div class=control-group> <input type=text data-bind=value: $data.DealCode name=DealCode
I have some elements as below: <div id=shareswrapper> <div id=41> some content blah blah

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.