diff --git a/selectInput.js b/selectInput.js index 675c74d09ec6742f03009d73b68adf337cbbfc09..f0509c91326e9dffc41d4bca39832510b7e6ffa8 100644 --- a/selectInput.js +++ b/selectInput.js @@ -176,15 +176,15 @@ layui.define(['jquery'], function (exports) { $(this).next().addClass(selectedCss + ' ' + upCss); $(this).next().find("dl").css({"display": "block"}); var dl = $(this).next().find("dl").children(); - var j = -1; + var j = 0; for (var i = 0; i < dl.length; i++) { - if (dl[i].innerHTML.indexOf(value) <= -1) { + if (dl[i].innerHTML.indexOf(value) === -1) { dl[i].style.display = "none"; j++; } else { dl[i].style.display = "block"; } - if (j === (dl.length - 2)) { + if (j === dl.length) { $(this).next().find("dl").css({"display": "none"}); } }