Hello to everyone, I Have a table inside 2 div's and I need to get the tables id!
How can I do this by javascript?
Dimonai
0
Newbie Poster
Recommended Answers
Jump to PostSince 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")) } …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.