-2

私は次のコードを持っています..現在その検証中ですが、エラーメッセージを1つずつ表示していません一度にすべてのエラーメッセージを表示したい...plzは事前に感謝します

if ( $('#employeeid').length > 0 ) {
            if ( $('#employeeid').val() || $('#employeeid').val() == '' ) {
                if( ! $('#employeeid').val().match(/^[I]{1}[BH]{1}[0-9]{1,4}$/i) ) {
                    $('#employeeid-element').append('<ul class="errors"><li><ul class="errors"><li>Please enter a valid employee id</li></ul>');
                      return false;
                  }
              }
          }



   if ( $("#firstname").val() || $("#firstname").val() == '') {
                if( ! $('#firstname').val().match(/^[a-z]{0,10}[\s]{0,2}[a-z]{0,10}$/i) ) {
                        $('#firstname-element').append('<ul class="errors"><li>Please enter a employee first name: firstname</li></ul>');
                        return false;
                    }

            } 
4

1 に答える 1

1

http://bassistance.de/jquery-plugins/jquery-plugin-validation/

おそらく、このプラグインは、簡単な方法でそれを行うのに役立ちます.

于 2012-08-07T08:29:15.820 に答える