How the jquery: contains selector calculates the number of matches

$(document).ready(function () {
    $("-sharpsearch").click(function () {
        var index = $.trim($("-sharpsearch_text").val().toString());
        $("li:contains("" + index + "")").show();
    });
});

as shown above, my goal is to perform front-end search after clicking the button, so how do I count the number of matches now?
$("li:contains ("" + index + ")"). Lenth; intended to write like this, but failed


should be OK. Is that why your length is wrong?


$("li:contains (" + index + ")"). Show ();
) just write this directly

Menu