Hi,
How do I get the id value of the header into the alert in the next example:
I'm now getting 'undefined' as result. I can put the function inline, as in onclick="alert('ID is: ' + this.id)", but I need it to work the other way.HTML Code:<!DOCTYPE html> <head> <script> function showID() { //return this; doesn't work ID = this.id; alert ('ID is: ' + ID); } </script> </head> <body> <h6 id="header" onclick="showID()">Header</h6> </body> </html>
Thanx in advance.



Reply With Quote
Check it out and let me know what you think of it: 
Bookmarks