jquery - Browser issue search code is working in Firefox not in Internet Explorer -
i have issue browser, have code in jsfiddle shows me match result providing input. working fine in ff not in ie
jquery version in jsfiddle jquery 1.9.1 ie ver. 9 , ff version 24.0
$("#searchinput").keyup(function () { //split current value of searchinput var data = this.value.tolowercase().split(" "); //create jquery object of rows var jo = $("#selectbox").find("option"); if (this.value == "") { jo.show(); return; } //hide rows jo.hide(); //recusively filter jquery object results. jo.filter(function (i, v) { var $t = $(this); (var d = 0; d < data.length; ++d) { if ($t.is(":contains('" + data[d] + "')")) { return true; } } return false; }) //show rows match. .show(); });
try this:
// on keydown on text box $("#txtinput").on("keyup", function (e) { var txt = $(this).val().tolowercase(); //if backspace pressed refresh list if (e.which == 8) { if (txt.length == 0) { renderlist(arrtext); } } if (txt.length >= 1) { var filterlist = searchinlist(arrtext, txt); if (filterlist.length > 0) { renderlist(filterlist); } else { renderlist(arrtext); } } });
will work in ie9 well, fiddle here: http://jsfiddle.net/m25uw/1/
Comments
Post a Comment