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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:36:27+00:00 2026-05-14T19:36:27+00:00

This is my Jquery <script type=text/javascript> $(function() { var from = $.session(from); var to

  • 0

This is my Jquery

     <script type="text/javascript">  
 $(function() {
 var from = $.session("from");
var to = $.session("to");

var $th = $('#theTable').find('th');
// had to add the classes here to not grab the "td" inside those tables
var $td = $('#theTable').find('td.bluedata,td.yellowdata');

 $th.hide();
 $td.hide();

if (to == "Select" || from == "Select") {
  // shortcut - nothing set, show everything
  $th.add($td).show();
  return;
}

 var filterArray = new Array();
filterArray[0] = to;
 filterArray[1] = from;

  $.each(filterArray, function(i){
    if (filterArray[i].toString() == "Select")
    {
        filterArray[i] = "";
    }
});   
$($th).each(function(){
    if ($( this,":eq(0):contains('" + filterArray[0].toString() + "')") != null
        && $(this,":eq(1):contains('" + filterArray[1].toString() + "')") != null)
    {
        $(this).show();
    }
});
 $($td).each(function(){
    if ($( this,":eq(0):contains('" + filterArray[0].toString() + "')") != null
        && $(this,":eq(1):contains('" + filterArray[1].toString() + "')") != null)
    {
        $(this).show();
    }
}); 
  });
  </script>

This is my table

 <table border="1" id="theTable">
    <tr class="headers">
        <th class="bluedata"height="20px" valign="top">63rd St. &amp; Malvern Av. Loop<BR/></th>
        <th class="yellowdata"height="20px" valign="top">52nd St. &amp; Lansdowne Av.<BR/></th>
        <th class="bluedata"height="20px" valign="top">Lancaster &amp; Girard Avs<BR/></th>
        <th class="yellowdata"height="20px" valign="top">40th St. &amp; Lancaster Av.<BR/></th>
        <th class="bluedata"height="20px" valign="top">36th &amp; Market Sts<BR/></th>
            <th class="bluedata"height="20px" valign="top">6th &amp; Market Sts<BR/></th>
        <th class="yellowdata"height="20px" valign="top">Juniper Station<BR/></th>
    </tr>
    <tr>
        <td class="bluedata"height="20px" title="63rd St. &amp; Malvern Av. Loop">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
        <td class="yellowdata"height="20px" title="52nd St. &amp; Lansdowne Av.">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
         <td class="bluedata"height="20px" title="Lancaster &amp; Girard Avs">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
         </td>
        <td class="yellowdata"height="20px" title="40th St. &amp; Lancaster Av.">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
        <td class="bluedata"height="20px" title="36th &amp; Market Sts">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
            <td class="bluedata"height="20px" title="6th &amp; Market Sts">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
        <td class="bluedata"height="20px" title="Juniper Station">
        <table width="100%"><tr><td>12:17am</td></tr><tr><td>12:17am</td></tr><tr><td>12:47am</td></tr></table>
        </td>
    </tr>
</table>

I have asked questions on here before and I have had success in converting textbox values to dropdown changes. However this is a bit different. I am using the sessions plugin (which works fine). On one page I have a set of normal drop downs, on submit you get taken to a separate page which runs the function above, however the rows/columns all show and they don’t seem to filter at all.

Edit: After looking at the code I think it is because if the item exists (!= null) it just shows all the TH or TR instead of the one selected.

  • 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-14T19:36:27+00:00Added an answer on May 14, 2026 at 7:36 pm

    I figured it out, for those interested.

         <script type="text/javascript">  
     $(function() {
     var from = $.session("from");
    var to = $.session("to");
    var $th = $('#theTable').find('th');
    var $td = $('#theTable').find('td.bluedata,td.yellowdata');
    
    if (to == "Select" || from == "Select") {
      // shortcut - nothing set, show everything
      $th.add($td).show();
      return;
    }
    
     $th.add($td).hide();
    $th.each(function(idx) {
          var notSelected = $(this).text();
          if ((notSelected.indexOf(to) != -1) || (notSelected.indexOf(from) != -1)) {
             // the text had the to or the from in it - so show this tr
             $(this).show();
             // and show its corresponding td
             $td.eq(idx).show();
          }
        });                      
     });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My script isn't getting data from JSON: <script type=text/javascript src=jquery-1.7.min.js></script> <script type=text/javascript> $(document).ready(function ()
I have a code like this <script type=text/javascript> function email(){ var myTextField = document.getElementById('email_hidden').value;
Hey guys, I have this piece of jquery code: <script type=text/javascript > $(function() {
I have this jQuery script var dataString = class_id=+class_id; $.ajax({ type: POST, url: page.php,
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
I had this jquery idle timeout script implemented into a site, thanks to ehynds
I have this at the top of my jQuery script: $().ajaxStart(function() { alert('ok'); });
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });
I have the following test ASPX page: <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js type=text/javascript></script> <script
I'm adding some <script/> tags from javascript to load some libraries (e.g., jquery). When

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.