[英]How to add clear input field option and refresh option list after clearing?
I have this HTML form example https://jsfiddle.net/j8re1cqa/ 我有这个HTML表单示例https://jsfiddle.net/j8re1cqa/
<form id="mainForm" method="post">
<input type="text" name="uniqueItem" list="itemlist">
<datalist id="itemlist">
<option data-value="10010">Placeholder name</option>
<option data-value="10006">Random name</option>
</datalist>
<input id="sendButton" type="submit" value="Submit">
</form>
How do I add a right-aligned icon inside input field to clear the input data? 如何在输入字段中添加右对齐图标以清除输入数据? There is an
X
in MS Edge, but there is no clear button visible in Chrome and Firefox. MS Edge中有一个
X
,但在Chrome和Firefox中没有可见的清除按钮。 In Firefox, the drop-down list is not even loading before you start typing. 在Firefox中,开始输入之前,甚至没有加载下拉列表。
When I delete the input data using backspace, the drop-down list refreshes only after I also left-click into the input field again. 当我使用退格键删除输入数据时,只有在我再次左键单击输入字段后,下拉列表才会刷新。 This feels really awkward and redundant.
这确实很尴尬和多余。 How to auto-refresh list when the interest keyword has more options again or when input field is empty?
当interest关键字再次具有更多选项或输入字段为空时,如何自动刷新列表?
我决定使用jQueryflexdatalist库: projects.sergiodinislopes.pt/flexdatalist/它提供了简单的实现和样式,这是默认数据列表无法很好完成的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.