niche Posted August 14, 2012 Share Posted August 14, 2012 (edited) I know event.currentTarget works with getAttribute, but I can't find a reference that says that. Is there one? If not why? I so, where should I look? Edited August 14, 2012 by niche Link to comment Share on other sites More sharing options...
justsomeguy Posted August 14, 2012 Share Posted August 14, 2012 event.currentTarget points to a DOM node, and DOM nodes support getAttribute. Look at a reference for DOM nodes. Link to comment Share on other sites More sharing options...
niche Posted August 14, 2012 Author Share Posted August 14, 2012 (edited) I reviewed the html dom tutorials, but couldn't find an explicit statement that made the connection between event.currentTarget and getAttribute although http://www.w3schools...odes_access.asp came close. http://www.w3schools.com/jsref/dom_obj_element.asp comes close too because an element is a node. Did you have another reference in mind? Edited August 14, 2012 by niche Link to comment Share on other sites More sharing options...
justsomeguy Posted August 14, 2012 Share Posted August 14, 2012 I'm not really sure what to say, this page: http://www.w3schools.com/jsref/event_currenttarget.asp says that it points to an element ("returns" isn't technically correct, it's a property not a function). Once you know it points to an element then you can look at the reference for elements to see what's available for it. A DOM node is basically the same thing as an element, but since we're working with Javascript we're working with the DOM. I think of an element as the rendered representation on a page, in Javascript it's a DOM node and in HTML it's a tag. They all represent the same thing. Link to comment Share on other sites More sharing options...
niche Posted August 14, 2012 Author Share Posted August 14, 2012 (edited) Thanks jsg. I was was confused about the difference between a node and an element. They're not mutually exclusive. An element is a type of node. Thanks again. Niche Edit: This topic was a big help in being able to better use the documentation. Edited August 14, 2012 by niche 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