title: Jquery function is starting on click but I need to stop it
body: <p>I always wonder that onclick functions start to a javascript or jQuery, but How does it stop? Finally, I faced with a function in my learning progress. May you help me to find a solution?</p>
  
  <p>I want to stop this function on another onclick:</p>
  
  <pre><code>function live_preview() {
          var icon = document.getElementById('LivePreIcon');
  
          if (icon.classList.contains('fa-eye-slash')) {
              icon.classList.remove('fa-eye-slash');
              icon.classList.add('fa-eye');
              $('#result').keyup(function () {
                  $('#dialog').html($(this).val());
              });
              return;
          }
          if (icon.classList.contains('fa-eye')) {
              icon.classList.remove('fa-eye');
              icon.classList.add('fa-eye-slash');
              // Stop the jquery function here
              return;
          }
  
      }
  </code></pre>