2012-02-23 89 views
0

我有這個腳本在jquery驗證下拉,文本框。用戶應該輸入或者下拉菜單或文本框,而不是兩個jquery添加類的自定義驗證

<script type="text/javascript" language="javascript"> 
    $(document).ready(function() { 
     $('input[id*=btnSubmit]').click(function() { 
      var ddlDiscountPercentVal = $('select[id*=ddlMktPercentages] option:selected').val(); 
      var txtDiscountValueVal = $('input[id*=TxtDiscountValue]').val(); 
      if ((ddlDiscountPercentVal == 0 && txtDiscountValueVal == '') || (ddlDiscountPercentVal != 0 && txtDiscountValueVal != 0)) { 
       alert('please enter a value other than 0 for percentage or enter a value'); 
       return false 
      } 
      else 

       return true; 

     }); 

    }); 

現在不是警告框,我想用顏色和錯誤的位置,正確的錯誤信息。我應該使用jQuery驗證庫

任何提示。感謝您的幫助 太陽

回答