lundi 20 avril 2015

jQuery check if input is empty

I am trying to get it where, if there is value in the input, go ahead and do your thing but if there isn't, don't do anything. I keep getting getting it where, if there is nothing in the input, a failure message occurs but only if I hit the enter key
http://ift.tt/1HnqYHU click the space in the lower right corner, then press enter. It shouldn't pop up, because the input is not focused.

login/failure jQuery:

$(document).ready(function(){
  $('.btn1').on('click', function(){
    var login = [marion, 'FATHER1'];

    var marion = $('#logging').val();
    marion = marion.toUpperCase();

    if (marion !== 'FATHER1' && $('#logging').val()) {
      alert('Login Failed');
  } else if (marion === 'FATHER1' && $('#logging').val()) {
    $('.notify').css('margin-top', '0');
      $('#logging').val('');
  }

  });
  $('.exit').on('click', function(){
    $('.notify').slideUp('slow');
  });
});

Aucun commentaire:

Enregistrer un commentaire