<img src="" alt="" width="" height=""> <img src="" alt="" > <img src="" alt=""> <script> var img = document.querySelectorAll('img:not([width]),img:not([height])'); alert(img.length); </script>