【26】jQuery实现的搜索列表过滤【好】
来源:互联网 发布:老虎机滚动抽奖js 编辑:程序博客网 时间:2024/05/29 18:53
可以直接复制代码,如果要拷贝到本地别忘了引用本地的jq ;
因为在这个csdn上不能直接预览
想预览的话去(前端网)预览
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>jQuery实现的搜索列表过滤</title> <style> body{background: #fff; font-size: 13px;} #wrap{position: relative;} .product-head h1{font-size: 14px;font-family: Arial, Helvetica, sans-serif;margin-bottom: 3px;margin-left: 3px;} .product-head{font-size: 12px;padding: 4px;background-color: #ccc;width: 235px;} .filterform input{font-size: 15px;padding: 3px;border: 1px solid #999;} li{padding: 5px;margin: 3px;list-style: none;width: 230px;border-top: 1px solid #ccc;} li a{color: #000;font-family: Arial, Helvetica, sans-serif;font-size: 11px} ul{margin: 0;padding: 0;} .clear{clear: both;} </style> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script> <script> (function ($) { jQuery.expr[':'].Contains = function(a,i,m){ return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0; }; function filterList(header, list) { var form = $("<form>").attr({"class":"filterform","action":"#"}), input = $("<input>").attr({"class":"filterinput","type":"text"}); $(form).append(input).appendTo(header); $(input) .change( function () { var filter = $(this).val(); if(filter) { $matches = $(list).find('p:Contains(' + filter + ')').parent(); $('li', list).not($matches).slideUp(); $matches.slideDown(); } else { $(list).find("li").slideDown(); } return false; }) .keyup( function () { $(this).change(); }); } $(function () { filterList($("#form"), $("#list")); }); }(jQuery)); </script></head><body><noscript><div id="noscript">需要开启浏览器的JavaScript功能才能查看更多效果!</div></noscript><div id="container"> <div id="wrap"> <div class="product-head"> <h1>搜索</h1> <div id="form"></div> <div class="clear"></div> </div> <ul id="list"> <li><p href="#/Apple/">html</p></li> <li><p href="#/Broccoli/">css</p></li> <li><p href="#/Carrot/">javascript</p></li> <li><p href="#/Celery/">jQuery</p></li> <li><p href="#/Lettuce/">less</p></li> <li><p href="#/Mushroom/">sass</p></li> <li><p href="#/Onion/">php</p></li> </ul> </div></body></html>
阅读全文
0 0
- 【26】jQuery实现的搜索列表过滤【好】
- jquery 实现百度搜索过滤的例子
- jquery+ajax列表过滤以及高亮的实现
- jquery列表的过滤示例
- jQuery实现仿百度搜索时的下拉列表
- 实现列表数据的过滤
- Android 仿联系人列表 实现ListView的A-Z字母排序和过滤搜索功能
- jQuery实现列表搜索(筛选)效果
- jQuery Mobile 列表过滤
- jquery实现仿select列表的即时搜索及拼音搜索
- 利用ligerUI实现类似数据列表过滤展示,类似JQuery datatable和某些框架的dataGrid
- input搜索筛选\过滤列表
- 做列表搜索的时候记得要进行过滤操作
- Android 仿联系人列表 实现ListView的A-Z字母排序和过滤搜索功能,并挤压效果(一)
- Android 仿联系人列表 实现ListView的A-Z字母排序和过滤搜索功能,并挤压效果
- Android联系人列表,实现ListView的A-Z字母排序和过滤搜索功能,字母条目上顶
- 利用jQuery和css实现的模仿百度搜索列表页面的分页的足迹效果
- 仿百度搜索时的下拉列表提示(jQuery实现)
- 17高软实验三报告
- Java微信语音开发
- upD79F8513A(NEC)或upD78F0511A(NEC)之串口6
- 51nod-1717-好数
- perl语言中的.pm文件和.pl文件有何区别
- 【26】jQuery实现的搜索列表过滤【好】
- Unity 与 Android 平台交互
- 基础知识
- Java中awt基本组件及其使用方法
- hexo搭建博客系统
- 小白的金句积累
- java的三大特征多态
- 客户机操作系统已禁用 CPU。请关闭或重置虚拟机。
- 训练LSTM模型进行情感分类在IMDB数据集上,使用Keras API(Trains an LSTM model on the IMDB sentiment classification)