I’m running jQuery 1.8.0.min.js
When I start to type into my input box to filter a List, nothing occurs and inside Chrome Debugger, I get the following error:
Uncaught TypeError: Cannot read property ‘3’ of undefined
Points to the line:
jQuery.expr[':'].Contains = function (a, i, m) {
return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase()) >= 0;
};
Code:
(function ($) {
jQuery.expr[':'].Contains = function (a, i, m) {
return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase()) >= 0;
};
function listFilter(list) {
var input = $('#classroomSearch');
$(input)
.change(function () {
var filter = $(this).val();
if (filter) {
$(list).find("a:not(:Contains(" + filter + "))").parent().slideUp();
$(list).find("a:Contains(" + filter + ")").parent().slideDown();
} else {
$(list).find("li").slideDown();
}
return false;
})
.keyup(function () {
$(this).change();
});
}
$(function () {
listFilter($("#filterList"));
});
}(jQuery));
I changed it to the above and it now works.
Found it here: https://github.com/nakajima/jquery-livesearch/issues/5