jquery自定义事件并实现数据传送

来源:互联网 发布:基金选择 知乎 编辑:程序博客网 时间:2024/05/22 03:03
$(document).ready(function() {var csEvent = {type: 'csEvent',message: 'This is customized event',time: new Date()};$('#send').on('click', function(e){e.preventDefault();$.event.trigger('csEvent',{"start":1, "end":2});});$(document).on('csEvent', function(e, obj){console.info(e);console.info(obj);console.log(JSON.stringify(obj));});});

0 0
原创粉丝点击