As has been mentioned in other answers, there is no pure HTML5 way to do this.
If you are already using JQuery, then this should do what you need:
$(document).ready(function() {_x000D_
$('#ourForm').submit(function(e){_x000D_
var form = this;_x000D_
e.preventDefault();_x000D_
// Check Passwords are the same_x000D_
if( $('#pass1').val()==$('#pass2').val() ) {_x000D_
// Submit Form_x000D_
alert('Passwords Match, submitting form');_x000D_
form.submit();_x000D_
} else {_x000D_
// Complain bitterly_x000D_
alert('Password Mismatch');_x000D_
return false;_x000D_
}_x000D_
});_x000D_
});
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>_x000D_
<form id="ourForm">_x000D_
<input type="password" name="password" id="pass1" placeholder="Password" required>_x000D_
<input type="password" name="password" id="pass2" placeholder="Repeat Password" required>_x000D_
<input type="submit" value="Go">_x000D_
</form>
_x000D_