myString=''; myKeys=document.getElementsByClassName('keyfield-value'); for(ix=0; ix<myKeys.length; ix++){ myString = myString+ myKeys[ix].innerHTML)+"\n"; } console.log(myString)