Created
April 2, 2009 18:13
-
-
Save jccovey/89328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Unnecessary when JQuery is available. Returns the first element | |
// of [elementType] in the DOM tree whose ID contains [name]. | |
function _getElementByPartialName(name, elementType) { | |
var elements = document.getElementsByTagName(elementType); | |
for (var i = 0; i < elements.length; i++) { | |
if (elements[i].getAttribute("id").indexOf(name) > -1) { | |
return elements[i]; | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment