<script> ar1 = document.getElementsByTagName('textarea'); for (var i=0 ; i< ar1.length; i++) console.log(ar1[i].id); ar2 = document.querySelectorAll("textarea"); for (var i=0 ; i< ar2.length ; i++) console.log(ar2[i].id); </script>