JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<form action="cmd" method="post" class="center" id="password_box" onsubmit="return validateForm()">
                                    <div id="password_container">
                                        <input type="password" name="pass" id="password_field" placeholder="Mot de passe"><br>
                                    </div>
                                    <input type="submit" name="submit" class="button" value="S'autentifier">
                            </form>
<p id="passwordInvalid" style="display:none">
WRONG PASSWORD FORMAT
</p>

JavaScript

var ok = null;
    var lastChanged = "";
        $(document).ready(function() {
					 $("[name=pass]").on("keyup change propertychange", onPassChange);
           });

        function onPassChange(e) {
            // get keycode of current keypress event
            var code = (e.keyCode || e.which);
            console.log(code);
            // do nothing if it's the enter key
            if(code != 13) {
                var init_val = $("#password_field").val();
               	//substitute the following with matching input to a regex meething your password requirements. THis is just for demonstration. 
                if(init_val !== "format"){
                	$("#passwordInvalid").show();
                }else{
                	$("#passwordInvalid").hide();
                }
               {
 
                }};
            }