Skip to content Skip to sidebar Skip to footer

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. Please s

Solution 1:

not too sure if I understand your question exactly .. are you looking for examples on how to use events with jquery.json2html? or how to pass an object to keep context using 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'});

Post a Comment for "Json2html EventData Example"