function findParentNode(el, parentQuerySelector) { // Expects a node for el and a querySelector string to find the parent
var parent = el.parentNode;
while(parent != document.querySelector(parentQuerySelector)) {
parent = parent.parentNode;
}
// Found it!
return parent;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.