Here is how we can get the value from a table element like td, th or tr having id or name attribute,
<table>
<tr>
<td id="td_tag">Test</td>
</tr>
</table>
For the above td tag we can get the inner content by,
document.getElementById("td_tag").innerText;
document.getElementById("td_tag").textContent;
Example:
<html>
<head>
</head>
<body>
<table>
<tr>
<td onClick="getTableInnerConent();" id="td_tag">This is some text!</td>
</tr>
</table>
</body>
<script>
function getTableInnerConent() {
alert(document.getElementById("td_tag").innerText);
alert(document.getElementById("td_tag").textContent);
}
</script>
</html>
More Posts related to Html,
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key
- HTML5 HELLO WORLD Example
- What is the doctype for HTML5?
- The author stylesheet specified in tag script is too long - document contains 21759 bytes whereas the limit is 10000 bytes
- W3 : character data is not allowed here html validation error
- HTML, HTML5. CSS, CSS3 Color Codes 2020
- Obsolete marquee element alternatives html5
- Create HTML button that looks like a href hyperlink
- All directional arrows codes for HTML
- Adding Sub Headings to Bootstrap Header tags
- Hyperlink in html (anchor tag) without a underline
- Align html element at the center of page vertically and horizontally
- How to remove old 404 pages ulrs from Google crawler
- How to set background color in HTML page?
- Default speed of Marquee tag : SCROLLAMOUNT
- W3 HTML validator warning Unable to Determine Parse Mode
- Get HTML table td, tr or th inner content value with id or name attribute
- reCaptcha Verification expired. Check the checkbox again
- How to word wrap in HTML
- Base 64 Index, Character and Binary Table
- Fibonacci series from 1 to 500 table
- How to make a div tag clickable
- Remove Html head and body tags from ckeditor source
- remove div vertical scroll
- Chessboard with pieces using pure HTML and CSS
More Posts:
- reCaptcha Verification expired. Check the checkbox again - Html
- Android Studio Native typeface cannot be made error - Android
- MySQL Error :1007 SQLSTATE: HY000 (ER_DB_CREATE_EXISTS) Message: Can't create database '%s'; database exists - MySQL
- Mac OS X Error: Could not create the Java Virtual Machine - Mac-OS-X
- Android [SDK Manager] The system cannot find the path specified - Android-Studio
- How to stop disable Facebook video autoplay during scroll - Facebook
- NewApi error : Finds API accesses to APIs that are not supported in all targeted API versions - Android
- JSON Text to JavaScript Object using eval() Example: JSON Tutorial - Json-Tutorial
- Failed to load the JNI shared library jvm.dll - Eclipse
- PHP Script to Upload Images to Server - PHP
- Get Device Screen Width and Height using javaScript - JavaScript
- How to get SharePoint List Item URL using PowerShell - SharePoint
- Your Android SDK is missing, out of date or corrupted SDK Problem - Android-Studio
- Send Email with attachment using SharePoint PowerShell - SharePoint
- How to add Newline to text in Android TextView - Android