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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:55:29+00:00 2026-05-16T19:55:29+00:00

I am looking for a way to do the following with a normal HTML

  • 0

I am looking for a way to do the following with a normal HTML table using jQuery.

  1. Extracting the index of the clicked cell and the index of the row it belongs too.
  2. Highlight the selected cell and remove the highlight when it is clicked again.
  3. Keep track of which cells that are selected so that I can save them into a database.

This is what I have done so far:

$("#frame td").click(function(e) {

    var RowSelected = $(this).parent().parent().children().index($(this).parent());
    var CellSelected = e.target.cellIndex;

    $(this).toggleClass("selected", this.clicked);

    $("#cells").append("R" + RowSelected + "C" + CellSelected + ", ");

});
  • 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-16T19:55:31+00:00Added an answer on May 16, 2026 at 7:55 pm

    DOM gives you rowIndex as well as cellIndex, there is no need for the crazy jQuery index work.

    Also if you postpone the generation of the list-of-selected-cells until submit-time you won’t have to try to keep track of them by adding and removing elements on click:

    $('#frame td').click(function() {
        $(this).toggleClass('selected');
    });
    
    $('#someform').submit(function() {
        $('#cells').val(
            $('#frame td.selected').map(function() {
                return 'R'+this.parentNode.rowIndex+'C'+this.cellIndex;
            }).get().join(', ')
        );
    });
    

    assuming #cells is a hidden input you’re using to pass the information.

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

Sidebar

Related Questions

I am doing the following within a jquery plugin and I'm looking a way
I was looking for way to perform form (post) request with SOAP using jQuery/AJAX.
I am looking for scalable way to do the following: User login Fetch all
I'm looking for another way of doing the following: function call_any_function(func, parameters){ // func
I'm looking for a way to do the following in Ruby in a cleaner
I'm looking for a much more idiomatic way to do the following little ruby
I'm looking for the best way to do the following.. I've got a loop
I'm looking for a way get the following from a users youtube name or
Server: Apache I'm looking to rewrite my urls in the following way, and I
I'm looking the way to create following dictionary NSDictionary *frameProperties = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber

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.