JSFiddle - React, Tailwind, and code Playground

HTML

<form>
        Password<br>
        <input id="psw" type="password" name="password" size="45" autofocus></input><br><br>
        <input type="submit" value="Submit" onclick="message();"></input>
  </form>
  
   <p id="display"></p>

JavaScript

function message () {
    if (document.getElementById("psw") = "thePassword") {
      document.getElementById("display").innerHTML = "Logged in";
    } else {
      document.getElementById("display").innerHTML = "Try again!";
    }}