我已將活動監視器的表單鏈接到移動網站,並且我正在使用jQuery驗證進行驗證。 所有在桌面瀏覽器上都能正常工作,但當我檢查我的Iphone時,驗證無效。jQuery驗證無法在iPhone上工作
我不是使用JQuery的經驗,所以任何幫助將不勝感激。
預先感謝您!
現場演示 http://files.perfectday.gb.com/internal/stackoverflow/mobile-form/get-your-coupon.php
我的驗證jQuery和形式如下。
<script type="text/javascript">
$.validator.methods.equal = function(value, element, param) {
return value == param;
};
$(document).ready(function(){
$("#subForm").validate({
rules: {
math: {
equal: <?php echo $randomNumTotal; ?>
}
},
messages: {
math: "Try again!!"
}
});
});
</script>
<!-- Form -->
<form action="http://perfectday.createsend.com/t/j/s/nyuyh/" method="post" id="subForm">
<div class="name">
<label for="name">Name:<span>*</span></label><br>
<input type="text" name="cm-name" id="name" size="25" class="required text-input" />
</div>
<div class="nyuyh-nyuyh">
<label for="nyuyh-nyuyh">Email Address:<span>*</span></label><br>
<input type="text" name="cm-nyuyh-nyuyh" id="nyuyh-nyuyh" size="25" class="required email text-input"/>
</div>
<div class="address1">
<label for="Address 1">Address 1:<span>*</span></label><br>
<input type="text" name="cm-f-juar" id="Address1" size="25" class="required text-input" />
</div>
<div class="address2">
<label for="Address 2">Address 2:<span>*</span></label><br>
<input type="text" name="cm-f-juaj" id="Address2" size="25" class="text-input required" />
</div>
<div class="city">
<label for="City">City/town:<span>*</span></label><br>
<input type="text" name="cm-f-juat" id="City" size="25"class="required text-input" />
</div>
<div class="postal">
<label for="postal">Post code:<span>*</span></label><br>
<input type="text" name="cm-f-juai" id="postal" size="25"class="required text-input" />
</div>
<div class="captcha">
Enter the correct result<span>*</span><br>
<input type="text" name="captchaImage" id="sum" value="<?php echo $randomNum ?> + <?php echo $randomNum2 ?>" disabled="disabled" />
<input type="text" name="math" id="math" maxlength="6" />
</div>
<input value="submit information" class="submit" type="image" src="images/trans.png" class="get-your-coupon-submit" alt="Submit" >
<br>
</form>
我的道歉。我會做。謝謝你的時間。 – perfectday 2012-02-23 17:08:23
當你說「驗證不起作用」你是什麼意思?我試着用我的iPhone和模擬器,並提交表單不會導致任何JavaScript錯誤。數學問題旁邊還有一個「再試一次」的文字。 在iPhone上打開Safari的調試控制檯通常很好。它可以在設置 - > Safari - >高級 - >調試控制檯中找到。 – 2012-02-23 19:05:40
通過驗證我的意思是在輸入正確的信息之前,不允許提交的功能。這個問題與jQuery-1.7.1無關。不完全確定原因。現在JQuery v1.3.2似乎適用於我。 – perfectday 2012-02-27 09:57:09