PS:思想是获取输入框的值,然后与下面的值进行对比,如果匹配到了就 show;否则就display:none
$("#basic-14").on("keyup",function(){
//按键起来以后获取值
var val = $("#basic-14").val();
//var arrs = $(".l-body >span");
//alert(arrs.size());
//var arrs1 = $(":not(.l-tree .l-body >span:contains("+val+"))");
//var arrs1 = $(".l-box-select-inner>.l-tree >li[outlinelevel=‘1‘]");
//alert($(arrs1[0]).html());
var arrs1 = $(".l-box-select-inner>.l-tree >li[outlinelevel=‘1‘]:not(:contains("+val+"))");///获取没有包含val的标签
var arrs2 = $(".l-box-select-inner>.l-tree >li[outlinelevel=‘1‘]:contains("+val+")");///获取没有包含val的标签
for(var i=0;i<arrs1.size();i++)
{
$(arrs1[i]).attr("style","display:none");
}
for(var i=0;i<arrs2.size();i++)
{
$(arrs2[i]).attr("style","display:show");
}
});
时间: 2024-10-07 10:30:05