假设我有一个搜索框,其中输入的任何内容都存储为:
var search_input = $(this).val();
我将如何用这个值搜索我的数组?
var devices = [{"Device_ID":"43","Image":"Amazon-Kindle-Fire.png","Manufacturer":"Amazon","Model":"Kindle Fire","Type":"Tablet"},{"Device_ID":"44","Image":"Apple-iPad.png","Manufacturer":"Apple","Model":"iPad","Type":"Tablet"}]
因此,假设我的 search_input 变量中有 Amazon 或 Kindle 等,我希望它搜索数组并输出以下内容。这同样适用于任何键入的内容或数组中的任何内容
<div id="device">43</div>
<div id="image">Amazon-Kindle-Fire.png</div>
<div id="name">Amazon Kindle Fire</div>