How to GetElementsByType?

I am trying to use JS to select elements with the type=button on my page. Because buttons share the same tagname as input fields I can’t select them this way.

Does anyone have any suggestions as to how I can do this?

var inputs = document.getElementsByTagName('input');

for(var i=0; i<inputs.length; i++){
   // your statements

Use the button tag instead of input type=“submit”:

<button type="submit">Send</button>

…also use if(inputs[i].type == “button”)