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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:46:10+00:00 2026-05-29T22:46:10+00:00

I’m somewhat new to jQuery and am just wondering how I go about passing

  • 0

I’m somewhat new to jQuery and am just wondering how I go about passing in a string value rather than what appears to be a reference to a jQuery item from a selector? I’m having a hard time explaining so here’s a sample demo. Don’t even know what to title this so please have at editing the title if you can think of a better one.

At the line where I do $("td").filter(function(str){ the str that is passed in becomes an index position of which TD I’m in. So while debugging the first time in it’s a 0 the next time a 1 and so on. I tried google but I’m not even sure what to search for, any documentation/code help would be much appreciated

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("select[name='showTeam']").change(function () {
            $("select[name='showTeam'] option:selected").each(function () {
                var str = $(this).val().toLowerCase();
                //str = what it was set to up there
                //alert(str);
                $("td").filter(function(str) {
                    //str = becomes a number = to position of TD.. ie for 5th TD match STR = 4 (starts at index 0)
                    return $(this).text().toLowerCase().indexOf(str) != -1;
            }).css('background','red');
        });
    })
});
</script>
Show Team: <select id="showTeam" name="showTeam">
    <option>All</option>
    <option>Chelsea</option>
    </select>

<div id="games">
  <table border="1">
  <tbody>
  <tr>
    <th>ID</th>
    <th>Game date</th>
    <th>Field</th>
    <th>Home team</th>
    <th>Home team score</th>
    <th>Away team</th>
    <th>Away team score</th>
    <th>Game type</th>
  </tr>
  <tr class="odd_line" id="game_460">
    <td>459</td>
    <td>03 Nov 19:00</td>
    <td>Field 2</td>
    <td>Madrid </td>
    <td>3</td>
    <td>Bayern Munich </td>
    <td>1</td>
    <td>Season</td>
  </tr>
  <tr class="odd_line" id="game_461">
    <td>460</td>
    <td>03 Nov 19:00</td>
    <td>Field 3</td>
    <td>chelsea</td>
    <td>5</td>
    <td>arsenal</td>
    <td>4</td>
    <td>Season</td>
  </tr>
</div>
  • 1 1 Answer
  • 2 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-29T22:46:12+00:00Added an answer on May 29, 2026 at 10:46 pm
    $(document).ready(function(){
        $("#showTeam").change(function () {
            var searchFor = $(this).val().toLowerCase();
            $("#games table tbody tr td:contains('" + searchFor + "')").parent().css('background','red');
        })
    });
    

    Demo

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

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.