如何在一个input框后面添加一个x,用来清除输入框的信息?

在 html5 中,input 标签中的 type 新增属性值为 search,使用该属性时浏览器默认会给input一个清除输入框

这也意味着,用作搜索时,input 的属性应该是 search 而不是 text

<html>
<body>

<input type="search" placeholder="搜索" >

</body>
</html>

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注