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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:43:00+00:00 2026-06-13T14:43:00+00:00

I have a table in HTML and I have some jquery functions which I

  • 0

I have a table in HTML and I have some jquery functions which I want to use with the table. But when I insert the two functions they stop working. Here is the code.

Function 1

// When document is ready: this gets fired before body onload <img     src='http://blogs.digitss.com/wp-includes/images/smilies/icon_smile.gif' alt=':)'     class='wp-smiley' /> 
window.onload = function () {
// Write on keyup event of keyword input element
$("#kwd_search").keyup(function () {
    // When value of the input is not blank
    if ($(this).val() != "") {
        // Show only matching TR, hide rest of them
        $("#tfhover tbody>tr").hide();
        $("#tfhover td:contains-ci('" + $(this).val() + "')").parent("tr").show();
    }
    else {
        // When there is no input or clean again, show everything back
        $("#tfhover tbody>tr").show();
    }
});
};
// jQuery expression for case-insensitive filter
$.extend($.expr[":"],
{
"contains-ci": function (elem, i, match, array) {
    return (elem.textContent || elem.innerText || $(elem).text() ||     "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
  });

Function 2

window.onload = function () {
var tfrow = document.getElementById('tfhover').rows.length;
var tbRow = [];
for (var i = 1; i < tfrow; i++) {
    tbRow[i] = document.getElementById('tfhover').rows[i];
    tbRow[i].onmouseover = function () {
        this.style.backgroundColor = '#ffffff';
    };
    tbRow[i].onmouseout = function () {
        this.style.backgroundColor = '#d4e3e5';
    };
}
};

Here is the HTML

<head runat="server">
<title></title>
 <script type="text/javascript"    src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

<script type="text/javascript" src="hl.js"></script> 
<script type="text/javascript" src="f.js"></script>    
<script type="text/javascript">



</script>


<style type="text/css">
table.tftable {font-size:12px;color:#333333;width:100%;border-width: 1px;border-color:    #729ea5;border-collapse: collapse; width:auto; overflow-x:auto;}
table.tftable th {font-size:12px;background-color:#acc8cc;border-width: 1px;padding: 8px;border-style: solid;border-color: #729ea5;text-align:left;}

table.tftable tr {background-color:#d4e3e5;}
table.tftable td {font-size:12px;border-width: 1px;padding: 8px;border-style: solid;border-color: #729ea5;}
    .auto-style1 {
        height: 32px;
    }
</style>
</head>
  • 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-13T14:43:01+00:00Added an answer on June 13, 2026 at 2:43 pm

    You second window.onload func is overriding the first.

    Also, with jquery, you call it WAY different make it way easier, something like :

    <head runat="server">
        <title></title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script type="text/javascript">
    
            $(function() {
                // Write on keyup event of keyword input element
                $("#kwd_search").keyup(function () {
                    // When value of the input is not blank
                    if ($(this).val() != "") {
                        // Show only matching TR, hide rest of them
                        $("#tfhover tbody>tr").hide();
                        $("#tfhover td:contains-ci('" + $(this).val() + "')").parent("tr").show();
                    }
                    else {
                        // When there is no input or clean again, show everything back
                        $("#tfhover tbody>tr").show();
                    };
                });
    
                // jQuery expression for case-insensitive filter
                $.extend($.expr[":"], {
                        "contains-ci": function (elem, i, match, array) {
                            return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
                        }
                });
    
                var tfrow = document.getElementById('tfhover').rows.length;
                var tbRow = [];
                for (var i = 1; i < tfrow; i++) {
                    tbRow[i] = $("#tfhover")[0].rows[i];
                    var row = $(tbRow[i]);
                    row.hover(function(eIn) {
                        $(this).css({ "background-color": "#ffffff" });
                    },
                    function(eOut) {
                        $(this).css({ "background-color": "#d4e3e5" });
                    });
                };
            })
    
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following psudeo html. I need to write some jquery which hides
I have an HTML table that contains some 500 rows. I have an input
I have a table in HTML which has three columns i.e Error - User
I have a table in which some adjacent cells have the same class (
I have the following JQ-Grid with a formatter function which returns some HTML as
In my main PHP page I have a table in which i entered some
I'm trying to use jQuery.post() function to retrieve some data. But i get no
I have a html table similar to this: <table> <tr> <td>1</td> <td>Some text...</td> </tr>
i have a table with a button which adds some rows to the table
I want to use jquery to do something depending on which checkbox is clicked.

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.