JSFiddle - React, Tailwind, and code Playground

HTML

<label>password :
  <input name="password" id="password" type="text" />
</label>
<br>
<label>confirm password:
  <input type="text" name="confirm_password" id="confirm_password" /> <span id='message'></span>

JavaScript

$('#confirm_password').on('keyup', function() {
  if ($(this).val() == $('#password').val()) {
    $('#message').html('matching').css('color', 'green');
  } else $('#message').html('not matching').css('color', 'red');
});