h5頁面嵌入安卓webview只輸入數字且限制10位

h5嵌入安卓webview只輸入數字且限制10位。

若是彈出數字鍵盤,須要改type='number'或'tel'android

oninput只輸入數字,別的字符replaceios

<input type="tel" id="account" maxlength="10" oninput="value=value.replace(/[^\d]/g,'')"/>

這樣就能夠啦~web

小記:瀏覽器

*h5的input type='number'的話,pc端的不一樣瀏覽器顯示效果不一樣。
1.輸入框帶有上下按鈕,
2.有的並無帶上下按鈕。
androidios設備不一樣的web內核的緣由,android的webview的number類型的輸入框的placeholder不顯示了,而ios的顯示*code

相關文章
相關標籤/搜索