I am getting the child nodes of en element and i want to check if the tags can actually contain text. For example:
,
Could use RegEx:
// these are samples, get elements text using element.innerHTML;
var one = "Links";
var two = "Lorem ipsum dolor";
function check(str){
return str.match(/<[a-zA-Z]+.*>(.|\n)*<\/[a-zA-Z]+>/) ? true : false;
}
console.log(check(one)); // true
console.log(check(two)); // false