I'm new here. Can you help we with this problem? I need to keep this modal open after refresh if password is not inserted. While refreshing the page modal disapears. I know it's problem with the cookies I put, but L can't figure out how to make it to stay after refresh. How to say to modal that password not inserted, show again. Please help :)
$(function() {
  $('.lev4o').modal({
    closable: false
  });
  let cookie = 0;
  if (cookie === 0) {
    $('.lev4o').modal('show');
    cookie = 1;
  }
});
$(document).ready(function() {
  // this prevents page reload on pressing enter
  $("form").submit(function(event) {
    event.preventDefault();
  });
  // click listener
  $('.fluid').click(function() {
    if ($('input:password').val() == "pass") {
      alert('Right Password!');
      $(".lev4o").modal('hide');
    } else {
      alert('Wrong Password!');
    }
  });
  // respond to enter key
  $('input:password').keyup(function(event) {
    if (event.keyCode == 13) {
      $('.fluid').click(); // trigger click
    }
  });
});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js" integrity="sha512-dqw6X88iGgZlTsONxZK9ePmJEFrmHwpuMrsUChjAw1mRUhUITE5QU9pkcSox+ynfLhL15Sv2al5A0LVyDCmtUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" integrity="sha512-8bHTC73gkZ7rZ7vpqUQThUDhqcNFyYi2xgDgPDHc+GXVGHXq+xPjynxIopALmOPqzo9JZj0k6OqqewdGO3EsrQ==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<div class="ui modal lev4o">
  <div class="ui middle aligned center aligned grid">
    <div class="login-eff">
      <div class="column">
        <h2 class="ui blue image header">
          <div class="content">
            Please enter the password !
          </div>
        </h2>
        <form class="ui form">
          <div class="ui  segment">
            <div class="field"></div>
            <div class="field">
              <div class="ui left icon input">
                <i class="lock icon"></i>
                <input type="password" name="password" placeholder="Password">
              </div>
            </div>
            <div class="ui fluid large primary submit button">Login</div>
          </div>
      </div>
      </form>