I have a DOM object obj of the type <input>, and want to get is parent node, but obj.parentNode gives back the same obj.Is this a specification of <input> objects? If so, what other kinds of DOM objects behave irregularly (returns anything other than its parent in an intuitive sense) like this?
Edit I must have done something wrong. sorry.
inputbehaves no differently than any other element on a page, and returning itsparentNode()should not return the input itself. Try it out:This will
alert“P”.I’m guessing that you’re not correctly testing for the parentnode.