HTML DOM 输入电话对象
HTML DOM 中的Input Tel 对象用于表示 type=“tel”的 HTML 输入元素。可以使用 getElementById() 方法访问 type= “tel” 的输入元素。
句法:
- 它用于访问输入电话对象。
document.getElementById("id");
- 它用于创建输入元素
document.createElement("input");
示例:下面的 HTML 代码说明了如何访问 Input Tel 对象。
HTML
GeeksForGeeks
DOM Input Tel Object
Click the button to get the
phone number of the Input Tel field.
HTML
GeeksForGeeks
DOM Input Tel Object
Click the button to create a input tel field.
输出:
示例 2:下面的 HTML 代码用于创建 Input Tel 对象。
HTML
GeeksForGeeks
DOM Input Tel Object
Click the button to create a input tel field.
输出:
支持的浏览器:
- 谷歌浏览器
- 火狐浏览器
- 边缘
- 苹果浏览器
- 歌剧