<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
</head>
<body>
<input type="password" id="pass-old" class="field-custom" placeholder="Старый пароль" name="password" value="123456">
<input type="password" id="pass-new" class="field-custom" placeholder="Новый пароль" name="password">
<button onclick="srav()">check</button>
<script>
var diag_nap_uchr = document.getElementById('pass-old');
var diag_osn = document.getElementById('pass-new');
document.querySelector('#pass-new').addEventListener('input', function(){
if (diag_nap_uchr.value === diag_osn.value){
alert ("Совпадение");
}
})
</script>
</body>
</html>
<input type="password" id="pass-old" class="field-custom" placeholder="Старый пароль" name="password" value="123456"> <input type="password" id="pass-new" class="field-custom" placeholder="Новый пароль" name="password">
у второго вообще value никакого и если вводить, то алерта нетif (oldPass.value === newPass.value) {
alert()
}