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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:28+00:00 2026-06-15T07:34:28+00:00

How to get selected table cell in in Table JavaScript without using jQuery? With

  • 0

How to get selected table cell in in Table JavaScript without using jQuery?
With jQuery decision is very simple, but in JavaScript without jQuery – I don’t know how.
I have table:

<table><tr onmouseover="toolnote(this)"><td><td><td></tr></table>

I need to bind “onmouseover” event to every cell in table, but if write this event to every cell it will be very unreadable. It follows that I must bind “onmouseover” to tag through the child and there determine the selected cell. But I do’t lnow how get the child index.

JS Code:

function toolnote(el){
    var tt = el.getElementsByTagName('td')
    alert(tt[0].innerHTML);
}

In this sample event binding to 0-index.

Anybody help me?

  • 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-15T07:34:29+00:00Added an answer on June 15, 2026 at 7:34 am

    Doubt!

    1. You have toolnote() as the function name and you are calling tooltip() on the element. Is this a typo?
    2. You are missing a ; in the statement.

    Simple Change:

    function toolnote(el){
        var tt = el.getElementsByTagName('td'); // «--- You are missing a ;
        alert(tt[0].innerText);
    }
    

    Or, if you use jQuery, then it is still easier.

    function toolnote(el){
        alert($(el).children("td").first().text());
    }
    

    You need this in each cell, then:

    <tr><td onmouseover="toolnote(this)"></td><td onmouseover="toolnote(this)"></td><td onmouseover="toolnote(this)"></td></tr>
    

    Make the JavaScript this way:

    function toolnote(el){
        alert(this.innerText);
    }
    

    In case of Firefox:

    function toolnote(el){
        alert(this.textContent);
    }
    

    And this is the reason, I said it will be better to use jQuery, as it handles this cross browser scripting issue, in a better way.


    In a Single Line:

    function toolnote(el) {
        var e = el.getElementsByTagName("td");
        if (e.textContent)
            for (i = 0; i < e.length; i++) e[i].onclick = function () {
                alert(this.textContent); // Firefox
            }
        else
            for (i = 0; i < e.length; i++) e[i].onclick = function () {
                alert(this.innerText); // IE
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
I have this setting below, but when I touch the table cell, I get
How do I get the selected value from a dropdown list using JavaScript? <form>
I'm currently working on a table application heavily coded in javascript using jQuery. When
I want to select a cell range in an HTML table and using Javascript
I am developing a webapp using Spring, jsp, javascript, jquery. I display a table
I have table that gets dynamically created. When using jQuery and toggle, everything works.
I have a table with selectable cells (via jQuery-UI selectable). Cells are selected individually,
I have a very strange problem,I don't know whether it is awkward to normal
Using either raw javascript or jQuery, I need to get the text from a

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.