使用jQuery检查街道地址的最小字符

Ran*_*ngh 0 jquery

我有一个 jQuery 函数来检查邮政编码中的数字字符。我还需要检查街道地址的最少字符数 (10)。

function paymentStep1(){

jQuerychk = jQuery.noConflict();
var numbers = /^[0-9]+$/; 
var zip = jQuerychk("input#id_billing_detail_postcode").val();  
if (zip.match(numbers))  {
document.getElementById("errormsssgen").innerHTML = '';
}else{      
    document.getElementById("errormsssgen").innerHTML = "ZIP code must have numeric characters only."
    return false;
}
Run Code Online (Sandbox Code Playgroud)

Con*_*eak 5

验证街道地址至少 10 个字符:

function validateStreetAddress(value){
  var l = value.trim().length;
  if (l < 10) {
    alert("Error: Street Address must be a minimum of 10 characters!");
    return false;
  }
}
Run Code Online (Sandbox Code Playgroud)