MrFies Posted December 17, 2012 Share Posted December 17, 2012 Hello, I didnt find something about that. Normally there is explained to get an Object with var MyElement = document.getElementById("MyDiv"); But now I have the Object from an Event-Handler and I want to get the id. I tried var myid = MyElement.id; //result should be "MyDiv" Can someone give me a hint? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 17, 2012 Share Posted December 17, 2012 That should do it. You can also try the getAttribute method, but the id property should have the element's ID if it was set. It might not have been set. Link to comment Share on other sites More sharing options...
MrFies Posted December 18, 2012 Author Share Posted December 18, 2012 thank you for answering, suddenly it works Oo - strange Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now