<div id="id1">id1</div><div id="id2">id2</div> <script> alert(document.getElementById("id1, id2").length); </script>