<!DOCTYPE html>
<html>
<head>
<title>kkk</title>
</head>
<body>
<input id = "money" name="money" type="text" >
<select name="months" id="months" >
<option value="3">3 (минимум)</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input type="button" id="elem" value="bum" name="">
<input name="capital" type="checkbox" >
<script type="text/javascript">
var face = document.getElementById("money")
var n = document.getElementById("months").options.selectedIndex;
var foo = document.querySelector('#months').value
var val = document.getElementById("months").options[n].value;
elem.onclick = function(){
alert(foo)
}
</script>
</body>
</html>
document.getElementById('months').addEventListener('change', function() {
const n = this.value;
})
document.addEventListener('DOMContentLoaded', () => {
const n = document.getElementById('months').value;
});