2👍
You may need to search those nodes inside the div recursively:
function findTextNode(node) {
const childNodes = node.childNodes;
if (childNodes.length > 0) {
for(let i=0; i<childNodes.length; i++) {
const child = childNodes[i];
const result = findTextNode(child);
if (result) {
return result;
}
}
return false;
} else {
const place = node.textContent.search('R');
if (!node.tagName && place!==-1) {
return node;
}
return false;
}
}
Working fiddle here: http://jsfiddle.net/1x6knn37/
- [Vuejs]-How can I set up Vue.js in my Laravel Project ?
- [Vuejs]-Vue.js 2-way data bind only working one way
Source:stackexchange.com