jQuery 下拉框输入匹配提示选项
做页面输入时,为方便输入和提高用户体验,常用下拉框,当下拉选项数据很多时,也不易找到想要的选项,这时,提供一种下拉框输入匹配提示选项,如下:
图示
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjwAAAEGCAIAAADuZNibAAAeK0lEQVR4nO3dz2/k2GHg8fwlBvwH+CQMkp0ckuwiC8wGMLDIKtis14dNNnPJJZgo6PUhWCQBjBwcJCtgMkljDSSHAcbGyO3ZeGwjznjsOElrutW/pqfV6m5LrVGppa7fxapiqfjjPe6BKooi33t8rCq1qqjvBw9CFYtFstpGffFISvMLEQAAS+IXLvsAAACwRbQAAEuDaAEAlgbRAgAsDaIFAFgaRAsAsDSIFgBgaRAtAMDSIFoAgEUj+52OL2V60cjpOK5HtAAAC0TK4Gh3587W1qOntaRbntv99M6dO3fuES0AwALxR71P79zZ2tra2traef4ylDK9hGgBABbLyGk+mFTq0dNnD++ePn648znRAgAsHLdbvzfpVuzT7X1fSqIFAFhEbuc4qda9B09PhIy4exAAsICE7+7cv5uaaN3ZP+5JogUAWDTCH/38swensbo7uaK1dWf/uKeO1srKiuVC+7eX2sLs75rjBud+AAAAHSm859ufxpm6e3/H9cPe8f6kW3e1M63km3pFJb9a5i2zbNPwRuVLZqW2ltms/foAgLnwR86j+3e3trbu3n88GAdRFEWR7B4/v2O+5T3/TW2TIss1DY8jiw6Z31v4KQwbVKaOaAHAqyT80e72497ITy9rHuzuv2gXX9MqnL7kv/ENMcjPYOzrqDu8qZ/qFhZG1P7wAABzVOJGDPOXtWH2Y1huUxH7/RqeJrEpm7EZmwoAmCNFtNLzCeXkqXC2YRmt9C7MbzdUxHCEuuPMTPXMW7P8aACAV6DENS3lOqXytpKb92Q2Zdi17tVST5W7M+zLZlMAgFdm1rsHI/38SblNm6gotzCvaJlzZViHaAHApbOKlu4lw1PlRCoz6yqsoM2MxzDDM+/RvFr+gxhiDAB4NeY80yrVG5vVzIEsXCEpjTk5ymhlXjJ/NADAK1AQr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AABXQqWiZXN60Lya7nRiOl35n5aHUf6fAQBwTqWiZbOCTTx0syubaJmPanN9dXV9M3la21g7fVrbWEvlbbLK5vrq2sZm8lIyqcrPtHRrAkClXLlopZ9aTrCiomgZ5lLZheeqlTTr3NLN9SRbm+uphG2uJzFSRku5JgBUSnWiFVmc+susnH+7YcuGn5m3p3eX22aqT2fzLN0q5ydm55YroqVaEwAqpVLRKsVmphVdwH9PKwlKrlnxbClGtABAoWrRKjV/sllh7tGaxCrdrNNcnZ38I1oAoHIVo2V/FtFwRtEyWqoDqG2sra5vnG9W+hIU0QIAjYpEq7BD6RoZUhQVtccyY+Y3nt4qeO7Wi8mT09fMKSJaAK6oikQrYTnTsnlqszzzOL1O8lRRu9rG2vmqpC5nrW+eNYdoAcA5lYqW4gJSmWgZJmT2j/PnGKPzPYsi/X2DtvhDGACuqOpES1ksw/IZV1DGyXIjtY21mZpT21gjWgCupOpEaznEl6xmKE72ehgAXCVECwCwNIgWAGBpVCpaunsupr7cNfW7ptuy5TbNH8fybhTLfQHAQrkS0VK+FKl+u6twg7qFU6xjOFTlIekeK7ege5BZf745B4CLdkHR+v8jW+JO4UqGcgAAAABJRU5ErkJggg==" alt="" />
HTML代码
<div style="width: 540px;">
<label class="control-label sr-only" for="search_dchannel_repo"></label>
<input class="form-control search-for-select" id="search_dchannel_repo" placeholder="Search" forselect="sel_all_apps" type="text">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
<div style="padding-top:8px;">
<select id="sel_all_apps" class="form-control" multiple="multiple" size="10"> <option class="proxy_app_option" value="48">测试应用</option> <option class="proxy_app_option" value="49">测试应用2</option> <option class="proxy_app_option" value="50">1323</option> <option class="proxy_app_option" value="51">僵尸战机</option> <option class="proxy_app_option" value="52">新游戏</option> <option class="proxy_app_option" value="53">测试APP</option> <option class="proxy_app_option" value="54">测试APP</option> <option class="proxy_app_option" value="55">测试APP</option> </select>
</div>
</div>
jQuery代码
$(".search-for-select").keyup(function(){
var select = $(this).attr("forselect");
var keyvalue = $(this).val();
$("#" + select).find("option").each(function(){
if($(this).html().indexOf(keyvalue) >= 0 || !keyvalue){
$(this).show();
}else{
$(this).hide();
}
});
return false;
});
jQuery 下拉框输入匹配提示选项的更多相关文章
- 带搜索框的jQuery下拉框插件
由于下拉框的条数有几十个,于是打算找一个可以搜索查找功能的下拉框,刚开始在网上看了几个,都是有浏览器兼容性问题,后来看到这个“带搜索框的jQuery下拉框美化插件 searchable”,看演示代码简 ...
- jQuery下拉框操作系列$("option:selected",this) &&(锋利的jQuery)
jQuery下拉框操作系列$("option:selected",this) &&(锋利的jQuery) <!DOCTYPE html> <ht ...
- Ajax jQuery下拉框联动案例
需求: 使用ajax和jQuery实现下拉框联动. 注意:需要加入jquery-2.1.1.min.js 前台 <!DOCTYPE html> <html> <head& ...
- jquery 下拉框 收藏
jquery 下拉框 Query获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code. ...
- Java-Selenium,获取下拉框中的每个选项的值,并随机选择某个选项
今天逛51testing,看见有人问这个问题.现在以Select标签为例. 1.首先看页面中的下拉框,如图: 2.F12查看页面源代码,如下 <select class="form-c ...
- jquery 下拉框插件,实现智能补全,模糊搜索,多选
近期已朋友问我问题,实现类似淘宝百度的下啦搜索条,看了网上好多帖子,都看起来好复杂,而且引用了好多没用的东西,而且多选选择内容多之后容易样式奔溃, 无奈之下只好自己改了, 话不多说上效果图: 模糊搜索 ...
- Jquery下拉框左右选择
1.说明 本文demo实现下拉框左右选择,本文地址:http://www.cnblogs.com/lengzhan/p/6423023.html 2.代码 <!DOCTYPE html PUBL ...
- jQuery下拉框扩展和美化插件Chosen
Chosen 是一个支持jquery的select下拉框美化插件,它能让丑陋的.很长的select选择框变的更好看.更方便.不仅如此,它更扩展了select,增加了自动筛选的功能.它可对列表进行分组, ...
- jQuery下拉框插件8种效果
jQuery自定义漂亮的下拉框插件8种效果 jquery美化选择器实例有:边框.下划线. 伸缩 .滑动. 覆盖. 旋转. 弹出层选择 .环形效果. 在线预览 <body class=" ...
随机推荐
- Java 调用OPENOFFIC 转换文档类型
public static void office2PDF(String sourceFile, String destFile) { try { File inputFile = new File( ...
- Web大文件(夹)上传(断点续传)控件-Xproer.HttpUploader6
版权所有 2009-2017荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webapp/up6.2/in ...
- Nginx 经验小结
chmod 777 永远不要 使用 777,有时候可以懒惰的解决权限问题, 但是它同样也表示你没有线索去解决权限问题,你只是在碰运气. 你应该检查整个路径的权限,并思考发生了什么事情. 把 root ...
- cocos2d-x AssetsManager libcurl使用心得
libcurl使用心得 最新正在写cocosclient更新的逻辑.研究了一下cocos2d-x自带的Libcurl,下面是自己在使用过程中的心得和遇到的未解问题.希望大家一起讨论一下,欢迎大家指导. ...
- node.js的http模块的基础 学到的东西
node.js的http模块的基础 学到的东西 其中客户端:我们在node.js中如果要请求服务端中的js或者其他脚本的话要使用http.request()方法他会返回http.ClientReque ...
- Android-解决Fail to post notification on channel "null"的方法
原文:https://blog.csdn.net/weixin_40604111/article/details/78674563 在sdk版本为25或25之前想在notification中添加一个点 ...
- Fragment 生命周期:
Fragment每个生命周期方法的意义.作用(注意红色的不是生命周期方法):setUserVisibleHint():设置Fragment可见或者不可见时会调用此方法.在该方法里面可以通过调用getU ...
- EasyDSS高性能流媒体服务器前端重构(五)- webpack + vue-router 开发单页面前端实现按需加载 - 副本
为了让页面更快完成加载, 第一时间呈现给客户端, 也为了帮助客户端节省流量资源, 我们可以开启 vue-router 提供的按需加载功能, 让客户端打开页面时, 只自动加载必要的资源文件, 当客户端操 ...
- sql server charindex函数和patindex函数详解(转)
charindex和patindex函数常常用来在一段字符中搜索字符或字符串.假如被搜索的字符中包含有要搜索的字符,那么这两个函数返回一个非零的整数,这个整数是要搜索的字符在被搜索的字符中的开始位数. ...
- Regularization: how complicated the model is? Regularization, measures complexity of model 使预测准确、平稳 predictive stable
http://www.kdd.org/kdd2016/papers/files/rfp0697-chenAemb.pdf https://homes.cs.washington.edu/~tqchen ...