I am wondering how to change the border of lock:before to solid transparent when the correct password is entered.
My JavaScript is like this, I need a lock before value to change to solid transparent when the IF is triggered
function lock(){
    alert("It's locked, you have to guess the password.");
    var pass = prompt("");
    if (pass == "opensesame") {
       alert("Lock opened");
       
    } else {
      alert("Wrong password"); 
}
}
My CSS is like this, lock before needs to be changed to solid transparent by a javascript function.
body {
    position: absolute;
    color: #00ff80;
    background: green;
    top: 100px;
    left: 200px;
}
#lock {
    font-size: 8px;
    position: relative;
    width: 18em;
    height: 13em;
    border-radius: 2em;
    top: 10em;
    box-sizing: border-box;
    border: 3.5em solid red;
    border-right-width: 7.5em;
    border-left-width: 7.5em;
    margin: 0 0 6rem 0;
  }
  #lock:before {
    content: "";
    box-sizing: border-box;
    position: absolute;
    border: 2.5em solid red;
    width: 14em;
    height: 12em;
    left: 50%;
    margin-left: -7em;
    top: -12em;
    border-top-left-radius: 7em;
    border-top-right-radius: 7em;
  }
  #lock:after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    border: 1em solid red;
    width: 5em;
    height: 8em;
    border-radius: 2.5em;
    left: 50%;
    top: -1em;
    margin-left: -2.5em;
  }
#button {
    background: transparent;
}
My HTML is like this, all it does is make a button and some text.
<!DOCTYPE html>
<html>
    <head>
        <title>The lock</title>
    </head>
    <body>
        <h1>Unlock the lock</h1>
        <button id=button onclick="lock()"><div id=lock></div></button>
    </body>
</html>
 
     
     
    