Find a Javascript parent node that matches a certain string

Here’s a small bit of javascript that I use in my Sencha Touch projects to find a parent with an id that matches a string. function findParentNodeRegex(regex, childObj) { var testObj = childObj; var count = 1; while(!testObj.id.match(regex)) { //console.log(‘My name is ‘ + testObj.id + ‘. Let\’s try moving up one level to see […]