js mendapatkan input formulir

var inputs = document.getElementById("my-form").elements;
var inputByIndex = inputs[0];
var inputByName = inputs["username"];
Alan Rivera-Muñiz