1

我有一个文本输入,用于在数据库中进行一些搜索:

<input type="text" ... onkeyup="searchProducts(event);" onfocus="searchProducts(event); ...

问题是当我onfocus在这个输入中它不断调用searchProducts函数时,这就是问题所在。
我只想在输入获得焦点时执行此操作。也许我应该改用别的东西onfocus

我使用干净的JavaScript没有JQuery

4

0 回答 0