如何在 HTML 中包含輸入欄位的合法數字間隔?
使用 step 屬性可在 HTML 中包含輸入欄位的合法數字間隔。HTML 輸入型別 step 屬性設定合法數字間隔。步長是數字步長,如 0、5、10、15、20 等。step 屬性可與 max 和 min 屬性一起使用,建立合法值的範圍。
示例
您可以嘗試執行以下程式碼來實現 step 屬性 -
<!DOCTYPE html> <html> <head> <title>HTML input step attribute</title> </head> <body> <form action = "" method = "get"> <input type = "number" name = "points" step = "5"><br> <input type = "submit" value = "Submit"> </form> </body> </html>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP