<form> <input type="text" /> <input type="text" /> <input type="submit" /> </form> <script> alert( document.querySelectorAll('form :not([type="submit"])').length ); </script>