title: Faking a login w/Javascript
body: <p>I'm creating a fake login experience in a pre-existing prototype. I think my problem is that there's already a click event on the button that advances it to the next div (it's a single page setup with divs that slide in) and I need to add the below validation functionality to the same button. Here's what I have so far:</p>
  
  <pre><code>$('#login_button').click(function(e){
    var username_input = $('input[placeholder*="Hint"]'), 
        password_input = $('input[placeholder*="Password"]'),
        username = $(username_input).val(),
        password = $(password_input).val(),
        login_errors = 0;
  
    if ((username == '') || (password == '')) {
      console.log("Please enter your username and password.");
      login_errors = 1;
    } else  if ((username == 'my_username') &amp;&amp; (password == 'my_password')) {
      console.log("Username and password are correct.");  
    } else {
      console.log("Your username or password are incorrect. Retry.");
      login_errors = 1;
    }
  
    if (login_errors != 0){
      e.preventDefault();
    }
  });
  </code></pre>
  
  <p>I'm getting a little lost there at the end. I can get the button to validate the input and to advance to the next page, but I don't know how to get it to do both of these things at the same time.</p>