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 8905535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:25:11+00:00 2026-06-15T02:25:11+00:00

I have a form which allows a user to filter a set of products.

  • 0

I have a form which allows a user to filter a set of products. When they click a radio button it will automatically submit the form to another section of the page via ajax, which means the page and the form is never refreshed. I have 3 sets of radio selections. I want to show the label of each current selection in another div so they can see the current filters applied at a glance. Here is what I have right now:

<form id="myform" action="blah.php">
  <label for="allprice">
    <input type="radio" name="cat[price]" id="allprice" value="1" />
    All Price Ranges</label>
  <label for="m-150-300">
    <input type="radio" name="cat[price]" id="m-150-300" value="2" />
    $150 - $300</label>
  <label for="m-300-700">
    <input type="radio" name="cat[price]" id="m-300-700" value="3" />
    $300 - $700</label>
  <br />
  <br />
  <label for="allmaterial">
    <input type="radio" name="cat[material]" id="allmaterial" value="4" />
    All Materials</label>
  <label for="straw">
    <input type="radio" name="cat[material]" id="straw" value="5" />
    Straw</label>
  <label for="felt">
    <input type="radio" name="cat[material]" id="felt" value="6" />
    Felt</label>
  <br />
  <br />
  <label for="allcolor">
    <input type="radio" name="cat[color]" id="allcolor" value="4" />
    All Colors</label>
  <label for="blue">
    <input type="radio" name="cat[color]" id="blue" value="5" />
    Blue</label>
  <label for="green">
    <input type="radio" name="cat[color]" id="green" value="6" />
    Green</label>
</form>

<div class="filters">
Current Filters: <span class="current-filters">Straw, Green</span>
</div>

Where it says “Current Filters” is where I want to list the current radio boxes selected. Additionally I want it to be ignored if “All” anything is selected.

How can I grab the label of selected radio boxes and display them elsewhere in a logical sense to comma separate except the last and ignore if “All” is selected? Furthermore if only “All” is selected for all of them how could I set it to say “No filters applied” Is this possible with jQuery?

  • 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-06-15T02:25:13+00:00Added an answer on June 15, 2026 at 2:25 am

    I’d suggest the following

    1. Wrap each section into a wrapper with a class (example below has div.control-group)
    2. For your “all” radio buttons, add an data attribute to distinguish from non-all items (example below uses data-all="all")

    HTML:

    <form id="myform" action="blah.php">
        <div class="control-group">
            <label for="allprice">
                <input type="radio" name="cat[price]" id="allprice" value="1" data-all="all" />
                All Price Ranges</label>
            <label for="m-150-300">
                <input type="radio" name="cat[price]" id="m-150-300" value="2" />
                $150 - $300</label>
            <label for="m-300-700">
                <input type="radio" name="cat[price]" id="m-300-700" value="3" />
                $300 - $700</label>
        </div>
        <br />
        <br />
        <div class="control-group">
            <label for="allmaterial">
                <input type="radio" name="cat[material]" id="allmaterial" value="4" data-all="all"/>
                All Materials</label>
            <label for="straw">
                <input type="radio" name="cat[material]" id="straw" value="5" />
                Straw</label>
            <label for="felt">
                <input type="radio" name="cat[material]" id="felt" value="6" />
                Felt</label>
    
        </div>
        <br />
        <br />
        <div class="control-group">
            <label for="allcolor">
                <input type="radio" name="cat[color]" id="allcolor" value="4" data-all="all"/>
                All Colors</label>
            <label for="blue">
                <input type="radio" name="cat[color]" id="blue" value="5" />
                Blue</label>
            <label for="green">
                <input type="radio" name="cat[color]" id="green" value="6" />
                Green</label>
    
        </div>
    </form>
    
    <div class="filters">
    Current Filters: <span class="current-filters"></span>
    </div>
    
    <button id="filter-me">Filter</button>
    

    Javascript (triggered on #filter-me button click):

    <script language="JavaScript">
        $('#filter-me').click(function(){
            var newarr = [];
            $('#myform .control-group input:checked').each(function(){
                if ($(this).attr('data-all') !== 'all') {
                    newarr.push($(this).closest('label').text());
                };
            });
            $('.current-filters').text(newarr.join(', '));
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which allows the user to set what the sort the
I have a HTML form which allows a user to add rows ad hoc
I have a php form which allows the user to provide a reference number
i have a form which allows the user to upload some files to a
I have the following form which allows a user to select dates/rooms for a
I have a form as below which allows user to select different collar types.
I have a form which allows my user to edit the information as required.
I have a micropost form which allows a user to upload a photo and
I have a form which allows users to comment on a page, however they
I have a form, which allows the user to change dependencies between two kinds

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.