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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:56:04+00:00 2026-05-17T15:56:04+00:00

Good morning, I am having trouble with the following code <html> <head> <title>highlight date</title>

  • 0

Good morning,

I am having trouble with the following code

<html>
<head>
<title>highlight date</title>
<style>
.row {
background-color: Yellow;
color:blue;
}

</style>
<script type="text/javascript">

</script>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript">
var currentTime = new Date();
var day = currentTime.getDate();
var month = currentTime.getMonth() + 1;
var year = currentTime.getFullYear();
var review = day + "/" + month + "/" + year;

</script>
<script language="javascript">
$(document).ready(function() {
$('#names td:contains(xxxx)').parent().addClass('row');
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="names">
<tbody>
<tr>
<td>1</td>
<td>review</td>
</tr>
<tr>
<td>2</td>
<td>Satheesh</td>
</tr>
<tr>
<td>3</td>
<td>08/10/2010</td>
</tr>
<tr>
<td>4</td>
<td>11/10/2010</td>
</tr>
<tr>
<td>5</td>
<td>xyz</td>
</tr>
</tbody>
</table>
</div>
</form>
<h4>It was
<script type="text/javascript">document.write(review)</script></h4>
</body>
</html>

I get get it to highlight a set string, but for some reason when ever i try to declare the variable “review” as what i want to search for and highlight, all it seems to find is the word review. can anyone help me on this at all please? its starting to do my head in.

Thankyou

  • 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-17T15:56:05+00:00Added an answer on May 17, 2026 at 3:56 pm

    I’m guessing you’re trying

    $('#names td:contains(review)').parent().addClass('row');
    

    you should instead concatenate your variable:

    $('#names td:contains(' + review + ')').parent().addClass('row');
    

    which will join '#names td:contains(' to the value of your variable, followed by ')'

    EDIT: I took pity. Below is my solution to the additional question you asked in the comments. Please note you should make the parseDate function more robust.

    $(document).ready(function() {
        function parseDate(dateString)
        {
            //You should address this function to be more robust
            return new Date(Date.parse(dateString));
        }
    
        $('#names tr').each(function(index)
        {
            var row = $(this);
            if (parseDate(elem.find("td:eq(1)").text()) < new Date())
                row.addClass('row');
        });
    });
    

    This gets each row and iterates through them. It gets the textual value of the SECOND (0-index) td, and parses it to a date. If this date is less than today, it applies the class.

    It DOES NOT check whether the data is an actual date or not, so you should add in that check somehow.

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

Sidebar

Related Questions

Good morning all, I'm having a few problems with a method in my C#
Good morning all. I'm having a small crisis with table views in a 3.1
Good morning! I'm having great success so far with CodeIgniter. I'm new to PHP
Good morning. As the title indicates, I've got some questions about using python for
Good morning people - I've been having this problem for hours and I can't
Good morning I'm trying to get a table row (TR) that must have one
Good morning to everybody, :) I have writen a code in C++ that reads
Good morning, I am about to start writing an Excel add-in for Excel 2002.
Good morning. I have an XML file which contains lists of warning and errors
Good morning, I am the developer of a medium sized PDA application that will

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.