jQuery usage of contains and toLowerCase()

后端 未结 4 1432
眼角桃花
眼角桃花 2020-12-10 13:35

I\'m trying to compare a string given in an input to a div\'s content using jQuery contain.

Problem is, I want to be able to check if the string is cont

4条回答
  •  独厮守ぢ
    2020-12-10 14:06

    You can use .filter [docs]:

    var dInput = this.value.toLowerCase();
    
    $(".dDimension").filter(function() {
        return $(this).text().toLowerCase().indexOf(dInput) > -1;
    }).css("display","block");
    

提交回复
热议问题