Comments (6)
回车事件自行绑定一下
<select id="select-id">
<!-- … -->
</select>
<script>
layui.use(function() {
var $ = layui.$;
$('body').on('keydown', '#select-id+', function(e) {
var value = e.target.value;
if (e.keyCode === 13) {
alert(value);
}
});
});
</script>
最好还是通过 form 的 select
事件统一处理,按回车键后最终也会触发 select
事件
from layui.
是 #select-id+
,不是 #select-id
,注意 +
from layui.
有时候需要自定义输入信息.本身没有,再去选择就麻烦了许多,按回车确认了最上面那条就方便了.能在这个前面处理拼音首字母搜索.
输入的无匹配项的时候,按下回车就把输入的信息作为值来处理
from layui.
回车事件自行绑定一下
<select id="select-id" lay-search="" lay-creatable=""> <!-- … --> </select> <script> layui.use(function() { var $ = layui.$; $('body').on('keydown', '#select-id', function(e) { var value = e.target.value; if (e.keyCode === 13) { alert(value); } }); }); </script>
最好还是通过 form 的
select
事件统一处理,按回车键后最终也会触发select
事件
刚试了下,没弹出
from layui.
from layui.
回车事件自行绑定一下
<select id="select-id"> <!-- … --> </select> <script> layui.use(function() { var $ = layui.$; $('body').on('keydown', '#select-id+', function(e) { var value = e.target.value; if (e.keyCode === 13) { alert(value); } }); }); </script>
最好还是通过 form 的
select
事件统一处理,按回车键后最终也会触发select
事件
select里面没有值,可以获取得到,但是里面本身有值, lay-search="" lay-creatable="" 创建出来的,获取不到!
from layui.
Related Issues (20)
- 关于Tree树组件后台动态获取数据源,加载之后显示大量未命名垃圾节点 HOT 1
- 我想在每次点击select出现下拉前异步加载一次值该如何实现 HOT 1
- 关于#1898的改动,大家要注意哦。lay-id有变更 HOT 2
- 当后台传的数据非正常数据时,前台导出会错误 HOT 1
- 表格中的文本框问题 HOT 3
- 关于layui-form表单<提示问题> HOT 3
- layer.tab打开多个iframe失败 HOT 1
- IOS QQ v9.0.71 内置浏览器无法使用 Upload组件 HOT 1
- 下拉筛选时不能**及时**变化,需要再次点开下拉框才会变化 HOT 2
- 表格的行右击事件如何获取鼠标所在列? HOT 9
- Tree组件的复选框半选状态 HOT 1
- 单选框(<input type="radio">)元素的name属性的值含空格会导致单选框变成多选【纯html没有这个问题】 HOT 1
- Layer弹窗位置不正确 HOT 2
- 轮播组件:点击图片利用HTML DOM Element remove() 方法动态删除图片操作出现错误 HOT 1
- 轮播组件:在form表单下,点击图片利用HTML DOM Element remove() 方法动态删除图片操作出现错误 HOT 6
- 请问使用table异步请求分页时,第三方服务使用skip分页要怎么处理?
- 表格默认导出XLSX的功能,怎么没有了?只有CSV格式。建议默认开启默认导出XLSX的功能,谢谢! HOT 3
- 按钮事件被多次提交,有没有遮罩或LOADING类的方法档一下.不让点击按钮,禁用了都没用.主要是能根本上解决只提交一次 HOT 3
- Slider 滑块,change事件返回值问题 HOT 2
- form表单提交事件textarea文本数据不同步 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from layui.