title: How to stop javascript from Multiple alerts?
body: <pre><code>    $('#ms_cats_meta_eduyear, #ms_cats_meta_semester, #ms_cats_meta_subject').change(function () {
  
  
  
                  $('#publish').removeClass('button-primary-disabled');
                  $('#save-post').removeClass('button-disabled');
  
                  $('input#publish').click( function () {
                      var eduyear_val = $("#ms_cats_meta_eduyear").val();
                      var semester_val = $('#ms_cats_meta_semester').val();
                      var subject_val = $("#ms_cats_meta_subject").val();
  
                      if (eduyear_val == -1 || semester_val == -1 || subject_val == -1){
                          var msg= "من فضلك تأكد من ادخال جميع حقول اختيار التصنيف.";
                          $('#ajax-loading').hide();
                          alert(msg);
                          return false;
  
                      }else{
                          $('#publish').removeClass('button-primary-disabled');
                          $('#save-post').removeClass('button-disabled');
  
                          return true;
                      }
  
                  });
  
  });
  </code></pre>
  
  <p>I'm using the function to produce an alert if the user tries to submit the form with the value of a three select boxes is -1. The Alert appears more than one time increasingle on making changes to the select box value, any idea what's wrong ?</p>