<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <title>JQ filter() 过滤函数</title> <script type="text/javascript" src="js/jquery-1.10.1.min.js"></script> </head> <body> <style type="text/css"> div { width:60px; height:60px; margin:5px; float:left; border:2px white solid; } </style> <div></div> <div class="middle"></div> <div class="demo"></div> <div class="middle"></div> <div class="middle"></div> <div></div> <script type="text/javascript"> //第一种,直接过滤选择器的元素 $("div").css("background", "#c8ebcc") .filter(".middle") .css("border-color", "red"); </script> <p style="clear:both;"></p> <ul> <li><a href="###">张三</a></li> <li><a href="###">李四</a></li> <li><a href="###">王五</a></li> <li><a href="###">赵六</a></li> <li><a href="###">张飞</a></li> </ul> <script type="text/javascript"> //第二种,过滤内容修改所在的标签样式 $("ul li").filter(":contains('张三'),:contains('李四'),:contains('王五')").css("background","#f60"); </script> <script type="text/javascript" src="js/jquery.textSearch-1.0.js"></script> <p class="cont">阅谁问君诵,水落清香浮。浮香浮。。。</p> <script> //第三种,过滤指定的内容并高亮 $(".cont").textSearch("浮香"); $(".cont").textSearch("阅 水",{markColor: "blue"}); </script> </body> </html>
效果图:
相关推荐
NULL 博文链接:https://onestopweb.iteye.com/blog/2290070
NULL 博文链接:https://onestopweb.iteye.com/blog/2337794
JQ CSS3过滤动画效果代码rar
jQuery本质上就是用javascript代码写成的各种方法的集合。但是javascript本身不是已经提供了各种各样的方法和功能了吗?为什么还要再另外写一个库出来呢?原因其实很好猜,那肯定是我们要写的这个库比javascript提供...
NULL 博文链接:https://onestopweb.iteye.com/blog/2339839
NULL 博文链接:https://onestopweb.iteye.com/blog/2290081
关于JSP的购物车jq维护+结算过滤器 不错的资料好好看看
主要介绍了jQuery中$.grep() 过滤函数 数组过滤的相关资料,需非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
利用filter函数可以从wrapper set中过滤符合条件的DOM元素,下面是其具体的用法,希望对大家有所帮助
NULL 博文链接:https://onestopweb.iteye.com/blog/2290023
NULL 博文链接:https://onestopweb.iteye.com/blog/2290062
NULL 博文链接:https://onestopweb.iteye.com/blog/2358944
NULL 博文链接:https://onestopweb.iteye.com/blog/2288908
使用jquery实现的类似京东商品的多条件过滤功能
·filter 函数是对当前对象集合进行过滤, 利用过滤条件缩小范围; ·find 函数的参数是 jQuery 选择器表达式; ·filter 的参数也是选择器表达式, 但可以有多个条件, 用逗号分隔(逻辑或关系); ·filter 的参数也可以...
JQ常用知识点梳理
NULL 博文链接:https://onestopweb.iteye.com/blog/2290078
针对jq的animate在ie低版本不兼容的情况,写的运动函数。
参考jquery封装的一些函数 目前有滚动,获取id/class/pro之类的,toggle,val,css() 获取id、class、 |功能|进度|完成| |--------- |jq()判断进去的类型#==id,class==. |完成| yes |css/attr获取或者修改当前节点的css...