How to GetElementsByType?

Hi,
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++){
 if(inputs[i].getAttribute('type')=='button'){
   // your statements
 }
}

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

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

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