Comments (4)
1、在init方法中,追加closeFn参数;
init: function(params) { ..... this.closeFn = params.closeFn; }
2、在取消函数中执行closeFn,并将表单元素作为参数传递给该方法;
//取消 function closeMobileCalendar(e) { ...... typeof _self.closeFn === 'function' && _self.closeFn( _self.trigger); }
3、在实例化调用时定义closeFn,操作表单元素获取值
var calendar = new LCalendar(); calendar.init({ 'trigger': '.datepicker', 'type': 'ym', 'minDate': '1900-1', 'maxDate': new Date().getFullYear() + '-' + (new Date().getMonth() + 1) , 'closeFn': function(oInput){ alert(oInput.value) } });
from lcalendar.
https://github.com/yudaren007007/qz-calendar 修改了一下,简单粗暴直接获取input.value就能取到值
from lcalendar.
你们都搞那么复杂干嘛?直接监听input事件就好了嘛
document.getElementById('你的id').addEventListener('input', e => {
console.log(e.target.value)
})
from lcalendar.
document.querySelector('#demo1').value
from lcalendar.
Related Issues (20)
- 改写了一下原作者的代码,一起交流一下咯! HOT 1
- 在苹果手机上正常显示,但是在安卓手机上调不了日历插件
- 时间选好后,确定,再点时间选择,点取消,选择的时间能消失吗?
- 按照您之前告诉别人的这个方法,点击确定只能获取年分,怎么获取月份呀?!
- Uncaught TypeError: Cannot read property 'querySelector' of null HOT 2
- 提示rs is not define
- 一个bug HOT 1
- 移动端rem支持(自问自答)
- 不支持require吗? HOT 1
- 这个怎么取值 HOT 2
- LCalendar.js 文件102行变量未定义
- 在苹果手机上不能正常显示,在有些安卓手机的微信浏览器上调不了日历插件 HOT 2
- 和vue似乎有冲突 HOT 2
- 日期选中后,如何获取值呢? HOT 4
- 没有秒? HOT 4
- 如何在重置时间节点个数时,指定范围 HOT 1
- 感谢作者提供的源码,在这个基础上添加了一些功能 HOT 1
- 设置最小日期为下个月,就会出现时间选择在12月份的情况 HOT 1
- 点击时间确定按钮有没有回调方法? HOT 3
- LCalendar 日期选择插件如何动态指定最小日期?
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 lcalendar.