【问题标题】:How to clear search input from a text box in html? [duplicate]如何从html中的文本框中清除搜索输入? [复制]
【发布时间】:2019-06-05 02:09:47
【问题描述】:

我有一个简单的问题。每当我想在搜索框中输入新内容时,如何编写一行代码以清除搜索输入历史记录?我正在编写一个与 YouTube 搜索栏交互的表单,因此无论我在搜索框中输入什么内容,它都会链接到 YouTube。

下面是图像文件,其中显示了我输入的输入历史记录,每当我刷新浏览器时它都不会清除。我是 html 的新手。

搜索输入:

<table class="tborder" cellpadding="$stylevar[cellpadding]" 
cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="right">
 <tr>
  <td class="thead" width="100%">
   <div style="text-align: left;">
    <strong>YouTube Search</strong>
   </div>
  </td>
 </tr>
 <tr>
  <td class="alt1" width="100%">
  <div class="smallfont" style="text-align: left;">
   <form id="vb_yt_search-form" action="http://www.youtube.com/results" method="get" target="_blank">
    <input id="vb_yt_search-term" name="search_query" type="text" maxlength="128" />
<select name="search_type">
 <option value="" >Videos</option>
 <option value="search_users">Channels</option>
</select>
<input type="submit" value="Search" />
</form>
</div>
 </td>
</tr>
</table>

【问题讨论】:

标签: html


【解决方案1】:

最好的办法是

<form autocomplete="off">



</form>

希望有帮助

【讨论】:

    【解决方案2】:

    你应该使用属性autocomplete="off"

    【讨论】:

      猜你喜欢
      • 2013-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-06
      • 2019-03-24
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      相关资源
      最近更新 更多