2
Contributors
2
Replies
21
Views
4 Years
Discussion Span
Last Post by Dimonai
2

Since you've provided no code, its difficult to provide specific guidance to solve your issue.

However, take a look at this example, you should be able to adapt to your needs...

<!DOCTYPE html>
<html>
<body>

<table id="table1"><tr><td>Test</td></tr></table>
<button onclick="myFunction()">Find ID</button>

<script>
function myFunction(){
  var x=document.getElementsByTagName("table")[0];
  document.write(x.getAttribute("id"))
}
</script>

</body>
</html>

You can copy/paste the above code in this Online HTML Editor to see the results...

Edited by JorgeM

0

Hello JorgeM, thank you for replying to this post of mine! Your example did what I needed for my project, thank you for helping me with this issue.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.