隱藏input輸入框的增減按鈕


 

當input 使用了type='number'后,會出現這個增減數值的按鈕,如上所示,

 

解決辦法:

1.type='text' ,改為輸入字符串,缺點是要做類型轉換,而且移動端不會調出純數字鍵盤

 

2.type='tel',改為電話號碼的類型,移動端中也是會調出純數字鍵盤的

 

3.type='number', 增加css樣式控制按鈕的顯示

/* 谷歌 */ 
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }

/* 火狐 */
input{
-moz-appearance:textfield; }

 

https://www.cnblogs.com/lizhaoyao/p/7568687.html

https://blog.csdn.net/github_38516987/article/details/78072570

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM