Используйте событие "oninput", если надо без кнопок:
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
</head>
<body>
<script>
function srav(){
var diag_nap_uchr = document.getElementById('pass-old');
var diag_osn = document.getElementById('pass-new');
if (diag_nap_uchr.value === diag_osn.value){
alert ("Совпадение");
}
}
</script>
<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" oninput="srav()">
</body>
</html>