Jquery不在android棒棒糖中工作..
问题描述:
我正在使用jquery验证整数和其他检查,如手机,密码等。
它的工作绝对没问题在网络浏览器中。但是当我在android浏览器或者android chrome中进行测试时它只是不工作。
我在谷歌搜索但没有找到任何合适的解决方案。
我尝试过:
我使用下面这个代码:
Hi,
I am using jquery validation for integers and other checking like mobile, pin code etc.
Its working absolutely fine in web browser. But when I am testing it in android browser or android chrome its just not working.
I searched in Google but did't found any suitable solutions.
What I have tried:
I used this bellow code:
function validate(evt) {
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode(key);
var regex = /[0-9]/;
if (!regex.test(key)) {
theEvent.returnValue = false;
if (theEvent.preventDefault) theEvent.preventDefault();
}
}
<input type="text" class="txtForexAmt" placeholder="0" value="@Model.TotalNoOfUnit" maxlength="10" />
答
这是一个已知问题。您是否尝试过其他设备的浏览器?这是棒棒糖的android WebView,表现得像那样。卸载webview也可以解决这个问题。
Its a known issue. Did you try any other browser of your device? It is the android WebView for lollipop which behaves like that. Uninstalling the webview could also fix the thing.