[英]json2html eventData example
It is my understanding from json2html Usage -> jquery that events can be hooked up inside json2html()
, but there doesn't seem to be an example in Examples -> jquery. 根据json2html用法-> jquery的理解,可以将事件挂接到
json2html()
,但是在示例-> jquery中似乎没有示例。
Please show a json2html eventData example. 请显示一个json2html eventData示例。
not too sure if I understand your question exactly .. are you looking for examples on how to use events with jquery.json2html? 不太确定我是否完全理解您的问题..您是否正在寻找有关如何将事件与jquery.json2html一起使用的示例? or how to pass an object to keep context using eventData?
或如何使用eventData传递对象以保持上下文?
In either case here's a simple example that does both: 在这两种情况下,以下都是一个简单的示例,它可以同时执行以下操作:
var data = [{'name':'click me'}];
var transform = {'tag':'button','html':'${name}','onclick':function(e){console.log(e.data);}};
$('#buttons').json2html(data,transform,{'eventData':'some data object'});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.