<input type = "text" style = "width: 100%;" id = "otprav" name = "otprav" />
<button type = "submit" class = "btn btn-default" id = "btnotprav" onclick = "buttonotprav()" style = "width: 100%;" >Отправить</button>
function buttonotprav () {
...
}
<form>
<input type="text" name="otprav">
<button>Отправить</button>
</form
document.querySelector("form").addEventListener("submit", function(e) {
e.preventDefault();
const data = new FormData(this);
alert("Учи основы форм! \n MSG: " + data.get("otprav"));
});