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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:17:27+00:00 2026-06-11T04:17:27+00:00

I made a table out of a simple list structure: <html> <body> <ul id=Column:0>

  • 0

I made a table out of a simple list structure:

<html>
    <body>
      <ul id="Column:0">
        <li id="Row:0></li>
        <li id="Row:1></li>
        <li id="Row:2></li>
        <li id="Row:3></li>
        <li id="Row:4></li>
      </ul>
      <ul id="Column:1">
        <li id="Row:0></li>
        <li id="Row:1></li>
        <li id="Row:2></li>
        <li id="Row:3></li>
        <li id="Row:4></li>
      </ul>
      <ul id="Column:2">
        <li id="Row:0></li>
        <li id="Row:1></li>
        <li id="Row:2></li>
        <li id="Row:3></li>
        <li id="Row:4></li>
      </ul>
    </body>
</html>

Now I want to add a simple .mouseover() to every row, for e.g. changing the color of a row, when hovered. And this is what I figured out, so far:

for (var i = 2;  i <= _totalRows; i++) {
    var row = $('#TimeTable ul li:nth-child(' + i + ')')
    row.each(function() {
        $(this).click(function(evt) {
            var $target = $(evt.target);
            console.log($target.nodeName)
            if (evt.target.nodeName == 'DIV') {
                console.log(evt.parent('li'));
            }
        }); //end $(this).click(fn)
    }); // end each(fn)
}

I get a set of all <li> objects matching to :nth-child(i) where i is the rows number.

var row = $('#TimeTable ul li:nth-child(' + i + ')')

Now I just iter this set through to add a .click(fn) to every <li>.
This works fine. Every cell has it’s .click(fn) attached to it.
But the following, what to do on a click, is where I’m stuck for several hours now:

var $target = $(evt.target);
console.log($target.nodeName)
if (evt.target.nodeName == 'DIV') {
    console.log(evt.parent('li'));
}

I simply don’t get it to run.
You can actually ignore this gibberish, as it’s just the last of several things I already tried here.

What I’m trying to do is simply select every <li> with an id=’Row:X’ and manipulate its CSS. The best I yet had was, that I can click a cell, but no matter in what row this cell is, the last one gets colored. I remember having used i as the row-index, when that happened, so I might miss some understanding of event-handling here, too.

  • 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-11T04:17:28+00:00Added an answer on June 11, 2026 at 4:17 am

    Use a class name for duplicate groups of elements not an ID. If you give row one a class of “Row1” the selector is simply:

    $('.Row1')
    

    Then:

    $('#TimeTable li').removeClass('highlight');
    $('.Row1').addClass('highlight');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to remove a row from an HTML table generated by some Rails
I have made a table row draggable with jQuery. It works as expected (mostly)
I have made a registration table reg1 and stored the values for every registered
I've made some changes in the table structure and especially the relationships between tables
What I want is pretty simple conceptually but I can't figure out how it
I made a simple query to update my table using php, but could not
I want to make a simple table that contains a custom button in a
I'm traying to extract info from a table made in xml, here is an
I have a MySQL database and with a php function i made a table
This is more like a question of principle. I made a table with 100%

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.