JSFiddle - React, Tailwind, and code Playground
HTML
<div>Mot de passe* : <input type="password" name="pwd" /></div>
<div>Confirmation* : <input type="password" name="pwdc" /></div>
JavaScript
$(function(){
$('[name="pwdc"]').on('blur', function(){
pw1= $(this).val();
pw2=$(this).parent().prevAll().find('[name="pwd"]:eq(0)').val();
if( pw1!==pw2){ alert('les mot de passe ne sont pas identiques !') }
})
})