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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:26:39+00:00 2026-06-17T22:26:39+00:00

I am making a tab pills for mo filter using zurb foundation. Is it

  • 0

I am making a tab pills for mo filter using zurb foundation.

Is it possible to combine this? I would like to use only 1 function because they are just almost the same just the variable is changing. Is it possible to make it more dynamic. I think .val() is not compatible with definition list.

<dl class="tabs pill">
  <dd class="active"><a class="allTab" href='#'>ALL</a></dd>
  <dd><a class="Tab1" href="#">filter1</a></dd>
  <dd><a class="Tab2" href="#">filter2</a></dd>
  <dd><a class="Tab3" href="#">filter3</a></dd> 
</dl>

JS:

$('.tab1').live('click',function(){
  var dis = $(this);
  var str= "filter1";
    $('#searchForm1').ajaxSubmit({
      type: 'get',
        url: '/sample/search?str='+str,
        beforeSend:function(){
          dis.text('Filtering...');
            dis.css({"font-size":"11px"});    
        },
        success:function(html){
          $('.sample').html(html);
              dis.text('filter1');
                dis.css({"font-size":"14px"});
        },
        error:function() {
          alert('Network Error..Please try again.');
        }
  });
});
$('.tab2').live('click',function(){
  var dis = $(this);
  var str= "filter2";
    $('#searchForm1').ajaxSubmit({
      type: 'get',
        url: '/sample/search?str='+str,
        beforeSend:function(){
          dis.text('Filtering...');
            dis.css({"font-size":"11px"});
        },
        success:function(html){
          $('.sample').html(html);
              dis.text('filter2');
                dis.css({"font-size":"14px"});
        },
        error:function() {
          alert('Network Error..Please try again.');
        }
  });
}); 
$('.tab3').live('click',function(){
  var dis = $(this);
  var str= "filter3";
    $('#searchForm1').ajaxSubmit({
      type: 'get',
        url: '/sample/search?str='+str,
        beforeSend:function(){
          dis.text('Filtering...');
            dis.css({"font-size":"11px"});
        },
        success:function(html){
          $('.sample').html(html);
              dis.text('filter3');
                dis.css({"font-size":"14px"});
        },
        error:function() {
          alert('Network Error..Please try again.');
        }
  });
});
  • 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-17T22:26:41+00:00Added an answer on June 17, 2026 at 10:26 pm

    Try it like this:

    <dl class="tabs pill">
       <dd class="active"><a class="allTab" href='#'>ALL</a></dd>
       <dd><a class="tab" id="Tab1" href="#" data-certiria='filter1'>filter1</a></dd>
       <dd><a class="tab" id="Tab2" href="#" data-certiria='filter1'>filter2</a></dd>
       <dd><a class="tab" id="Tab3" href="#" data-certiria='filter1'>filter3</a></dd> 
    </dl>
    
    function filterTab(cretiria, clickedTab) {
        $('#searchForm1').ajaxSubmit({
            type: 'get',
            url: '/sample/search?str=' + cretiria,
            beforeSend: function () {
                clickedTab.text('Filtering...');
                clickedTab.css({
                    "font-size": "11px"
                });
            },
            success: function (html) {
                $('.sample').html(html);
                clickedTab.text(cretiria);
                clickedTab.css({
                    "font-size": "14px"
                });
            },
            error: function () {
                alert('Network Error..Please try again.');
            }
        });
    }
    
    $('.tab').live('click', function () {
        var dis = $(this);
        var str = $(this).data("certiria");
        filterTab(str, dis)
    });
    

    Instead of coping the same ajax request code again create a separate function.
    Then use data elements inside that tabs to hold the required filter criteria.
    then use one generic click function that retrieves that data element and sends it to the ajax function to manage the request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making firefox extension. One function stores value in every tab, to use it
I'm making a Greasemonkey script and would like to open a new tab which
I am making a tab app using this tutorial . When I run my
I have been making this app, if you click the top left tab it
Im making a batch game, and made a email screen which looked like this
i am making a facebook tab which using iframe to show the tab content
By making use of the remote feature in vim, is it possible to reuse
I am making a top menu, and it looks like this: https://i.stack.imgur.com/5O5G5.png The contact
I'm making an application in which m using Tab Bars. Now what i need
I'm making a small Android application to show current total CPU usage like tab

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.