Let's assume I have a jQuery object of a DIV element in body. I'd like to obtain document object by traversing. Can it be possible ?
Note: window.document is not a option in my case.
Thank you.
Let's assume I have a jQuery object of a DIV element in body. I'd like to obtain document object by traversing. Can it be possible ?
Note: window.document is not a option in my case.
Thank you.
element.ownerDocument
will give you a reference to the document to which any DOM element belongs.
Yes, the document
object is the parent of the <HTML>
element (at least in Firefox). Find it like this:
function FindDoc(el) {
while(el.parentNode) {
el = el.parentNode;
}
return el;
}
firstElementChild The first child that is an element node Traversal module.