<a class="mJS">Открыть</a>

<div class="modal">
  <div class="content">
      
      <div class="inputName">
        <input type="text" class="nameInput">
      </div>

  </div>
</div>
.modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  z-index: 3;
  background-color: rgba(0, 0, 0, 0.6);
  transform: scale(1.1);
  transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
}

.content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50.2%, -50.2%);
  background-color: #fff;
  width: 500px;
  padding: 32px 46px;
}

.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1.0);
    transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}


.nameInput {
    height: 56px;
    border: 1px solid gray;
    box-sizing: border-box;
    border-radius: 8px;
    display: block;
    float: left;
    width: 100%;
    padding: 0 25px;
    font-size: 16px;
    background: #f7f7f7;
    outline: none;
}

.nameInput:focus {
    border: 1px solid red;
}
var btn = document.querySelector(".mJS");
var modal = document.querySelector(".modal");

function toggle() {
  modal.classList.toggle("show");
  const input = document.querySelector('.nameInput');
  input && input.focus();
}

btn.addEventListener("click", toggle);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.