title: Created function with jquery and want use onclick but thats dont work
body: <p>I have a form and want to add onClick function. <code>onclick()</code> function opens panel two!</p>
  <p>When you click on grin line on right thats opens panel two I cut same function and put in another function which I gave onclick but it doesn't work.</p>
  <p>This is my code I tried.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
    var panelOne = $(".form-panel.two").height(),
      panelTwo = $(".form-panel.two")[0].scrollHeight;
  
    $(".form-panel.two")
      .not(".form-panel.two.active")
      .on("click", function (e) {
        e.preventDefault();
  
        $(".form-toggle").addClass("visible");
        $(".form-panel.one").addClass("hidden");
        $(".form-panel.two").addClass("active");
        $(".form").animate(
          {
            height: panelTwo,
          },
          200
        );
      });
  
    $(".form-toggle").on("click", function (e) {
      e.preventDefault();
      $(this).removeClass("visible");
      $(".form-panel.one").removeClass("hidden");
      $(".form-panel.two").removeClass("active");
      $(".form").animate(
        {
          height: panelOne,
        },
        200
      );
    });
  });
  
  function login() {
    $(document).ready(function () {
      var panelOne = $(".form-panel.two").height(),
        panelTwo = $(".form-panel.two")[0].scrollHeight;
  
      $(".form-panel.two")
        .not(".form-panel.two.active")
        .on("click", function (e) {
          e.preventDefault();
  
          $(".form-toggle").addClass("visible");
          $(".form-panel.one").addClass("hidden");
          $(".form-panel.two").addClass("active");
          $(".form").animate(
            {
              height: panelTwo,
            },
            200
          );
        });
    });
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.overlay,
  .form-panel.one:before {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    background: rgba(0, 0, 0, 0.8);
    width: 100%;
    height: 100%;
  }
  
  .form {
    z-index: 15;
    position: relative;
    background: #ffffff;
    width: 600px;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    margin: 110px auto 100px;
    overflow: hidden;
  }
  .form-toggle {
    z-index: 10;
    position: absolute;
    top: 60px;
    right: 60px;
    background: #ffffff;
    width: 60px;
    height: 60px;
    border-radius: 100%;
    transform-origin: center;
    transform: translate(0, -25%) scale(0);
    opacity: 0;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  .form-toggle:before,
  .form-toggle:after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 4px;
    background: #2eca6a;
    transform: translate(-50%, -50%);
  }
  .form-toggle:before {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  .form-toggle:after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }
  .form-toggle.visible {
    transform: translate(0, -25%) scale(1);
    opacity: 1;
  }
  .form-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 0 0 20px;
  }
  .form-group:last-child {
    margin: 0;
  }
  .form-group label {
    display: block;
    margin: 0 0 10px;
    color: rgba(0, 0, 0, 0.6);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.2em;
  }
  .two .form-group label {
    color: #ffffff;
  }
  .form-group input {
    outline: none;
    display: block;
    background: rgba(0, 0, 0, 0.1);
    width: 100%;
    border: 0;
    border-radius: 4px;
    box-sizing: border-box;
    padding: 12px 20px;
    color: rgba(0, 0, 0, 0.6);
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    line-height: inherit;
    transition: 0.3s ease;
  }
  .form-group input:focus {
    color: rgba(0, 0, 0, 0.8);
  }
  .two .form-group input {
    color: #ffffff;
  }
  .two .form-group input:focus {
    color: #ffffff;
  }
  .form-group button {
    outline: none;
    background: #2eca6a;
    width: 100%;
    border: 0;
    border-radius: 4px;
    padding: 12px 20px;
    color: #ffffff;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    line-height: inherit;
    text-transform: uppercase;
    cursor: pointer;
  }
  .two .form-group button {
    background: #ffffff;
    color: #2eca6a;
  }
  .form-group .form-remember {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
  }
  .form-group .form-remember input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin: 0 10px 0 0;
  }
  .form-group .form-recovery {
    color: #2eca6a;
    font-size: 12px;
    text-decoration: none;
  }
  .form-panel {
    padding: 60px calc(5% + 60px) 60px 60px;
    box-sizing: border-box;
  }
  .form-panel.one:before {
    content: "";
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
  }
  .form-panel.one.hidden:before {
    display: block;
    opacity: 1;
    visibility: visible;
  }
  .form-panel.two {
    z-index: 5;
    position: absolute;
    top: 0;
    left: 95%;
    background: #2eca6a;
    width: 100%;
    min-height: 100%;
    padding: 60px calc(10% + 60px) 60px 60px;
    transition: 0.3s ease;
    cursor: pointer;
  }
  .form-panel.two:before,
  .form-panel.two:after {
    content: "";
    display: block;
    position: absolute;
    top: 60px;
    left: 1.5%;
    background: rgba(255, 255, 255, 0.2);
    height: 30px;
    width: 2px;
    transition: 0.3s ease;
  }
  .form-panel.two:after {
    left: 3%;
  }
  .form-panel.two:hover {
    left: 93%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  }
  .form-panel.two:hover:before,
  .form-panel.two:hover:after {
    opacity: 0;
  }
  .form-panel.two.active {
    left: 10%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    cursor: default;
  }
  .form-panel.two.active:before,
  .form-panel.two.active:after {
    opacity: 0;
  }
  .form-header {
    margin: 0 0 40px;
  }
  .form-header h1 {
    padding: 4px 0;
    color: #2eca6a;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .two .form-header h1 {
    position: relative;
    z-index: 40;
    color: #ffffff;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!-- Form--&gt;
      &lt;div class="form"&gt;
          &lt;div class="form-toggle"&gt;&lt;/div&gt;
          &lt;div class="form-panel one"&gt;
              &lt;div class="form-header"&gt;
                  &lt;h1&gt;Մուտք&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div class="form-content"&gt;
                  &lt;form&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="username"&gt;Անուն&lt;/label&gt;
                          &lt;input type="text" id="username" name="username" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="password"&gt;Գաղտնաբառ&lt;/label&gt;
                          &lt;input type="password" id="password" name="password" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="form-remember"&gt;
                              &lt;button onclick="login()"&gt;Գրանցվել&lt;/button&gt;
                          &lt;/label&gt;
                          &lt;a class="form-recovery" href="#"&gt;Մոռացե՞լ ես գաղտնաբառը&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;button type="submit"&gt;Մտնել&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-panel two"&gt;
              &lt;div class="form-header"&gt;
                  &lt;h1&gt;Գրանցվել&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div class="form-content"&gt;
                  &lt;form&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="username"&gt;Անուն&lt;/label&gt;
                          &lt;input type="text" id="username" name="username" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="password"&gt;Գաղտնաբառ&lt;/label&gt;
                          &lt;input type="password" id="password" name="password" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="cpassword"&gt;Հաստատել գաղտնաբառը&lt;/label&gt;
                          &lt;input type="password" id="cpassword" name="cpassword" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="email"&gt;Էլ․ հասցե&lt;/label&gt;
                          &lt;input type="email" id="email" name="email" required="required" /&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;button type="submit"&gt;Գրանցվել&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>