Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Greuter ludder

View GitHub Profile
@ludder
ludder / getParentByTagName.js
Created Nov 9, 2012
getParentByTagName - Get parent node for given tagname
View getParentByTagName.js
/**
* Get parent node for given tagname
* @param {Object} node DOM node
* @param {String} tagname HTML tagName
* @return {Object} Parent node
*/
function getParentByTagName(node, tagname) {
var parent;
if (node === null || tagname === '') return;
parent = node.parentNode;
You can’t perform that action at this time.