Cannot read property 'length' of undefined
<p class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
var str = document.getElementsByClassName('text');
[].forEach.call(str, function(el){
var res = el.value.length;
el.innerHTML = res;
console.log(res);
});