如何使用 CSS 清除焦点指向的输入字段?
cssweb developmentfront end technology更新于 2025/10/5 16:44:17
以下代码用于清除焦点指向的输入字段 −
示例
<!DOCTYPE html> <html> <head> <h1>Clearing an input field on focus example</h1> <input type="text" onfocus="this.value=''" value="Some random text..."> <h2>Click on the above field to clear its value</h2> </body> </html>
输出
上述代码将产生以下输出 −

点击该字段时,内部值将被清除 −

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

