可选择也可自定义的输入框实现(原创)
来源:互联网 发布:下载炫浪网络社区app 编辑:程序博客网 时间:2024/05/16 01:26
1.效果:
2.依赖文件 jquery.js bootstrap.js bootstrap.min.css
3.html
<div class="customInput"><div class="inputDiv"><input type="text" id="text" name="text" /><button class="listBtn"><b class="arrow glyphicon glyphicon-menu-down pull-right black" style="color: #000000;"></b></button></div><div class="selectDiv"><ul class="hidden"><li>111</li><li>111</li><li>111</li><li>111</li></ul></div></div>
4.css
<style>.customInput{width: 250px;margin-left: 100px;margin-top: 100px;}.customInput .inputDiv{width: 250px;margin: 0px;}.customInput .inputDiv input{width: 88%;height: 28px;display: block;float: left;border-right-width: 0px;border-bottom-left-radius: 5px;border-top-left-radius: 5px;}.inputHover{border-bottom-left-radius: 0px;}.listBtnHover{border-bottom-right-radius: 0px;}.customInput .inputDiv .listBtn{width: 12%;height: 28px;display: block;float: left;border-bottom-right-radius: 5px;border-top-right-radius: 5px;}.customInput .selectDiv{width:100%;}.hidden{display: none;}.customInput .selectDiv ul{margin: 0px;padding: 0px;border: solid 1px #000000;height: 200px;width:100%;overflow-y: scroll;}.customInput .selectDiv ul li{text-align: left;padding: 6px 0px 8px 8px;height:28px;list-style: none;}.customInput .selectDiv ul li:hover{background-color: cornflowerblue;}</style>JS:
$(".customInput").mouseover(function(){$(".customInput .selectDiv ul").removeClass('hidden');});$(".customInput").mouseout(function(){$(".customInput .selectDiv ul").addClass('hidden');});$(".customInput .selectDiv ul li").click(function(){$(".customInput .inputDiv input").val($(this).text());$(".customInput .selectDiv ul").addClass('hidden');});
0 0
- 可选择也可自定义的输入框实现(原创)
- 可选择也可输入的下拉列表框,html文件
- 可输入可选择的下拉框
- 自定义 既可输入文字又可选择的 控件ComBox
- 下拉框可输入可选择
- 可输入可选择下拉框
- 可输入可选择的下拉框(input select)并且输入框获得下拉的内容
- 可选择也可以输入的下拉列表框
- js:可输入可选择的select下拉框,可及时匹配包含输入的内容(兼容ie)
- 动态生成可输入可选择的控件
- 可输入可选择的下拉列表
- magicsuggestjs 可输入可选择下拉框记录
- 自定义 既可输入文字又可选择的 控件ComBox—2
- 仿下拉框,可选择,可输入,可匹配
- 以JSon来实现TextBox可选择可输入
- 可选择和输入的下拉列表框
- 可选择和输入的下拉列表框
- jquery实现下拉框可自定义输入文本的功能
- 【剑指offer】链表中倒数第k个结点
- 《Faster R-CNN Features for Instance Search》论文阅读
- android中自定义dialog的使用方法简介
- 字典树的插入 删除 查找
- Opencl编程错误总结
- 可选择也可自定义的输入框实现(原创)
- 关于文字内容溢出用点点点(…)省略号表示
- docker-batman
- KNN算法C++实现
- SQL SERVER 2008同表字段更改
- 算法竞赛入门经典(第2版)习题1-1详解
- java 是如何进行异常处理的
- Lua判断OS并添加cpath
- Struts2 拦截器处理普通Http请求和Ajax请求时拦截配置