ok I'm not sure if I'm doing this right so if I'm going about it all wrong please explain.
I have a javascript object which is drawing html based on ajax data.
I am then trying to use jquery to handle events on the html output from an instance of the above object. However I would like to call a function and get a property out of the instance of the javascript object which was used to draw the html.
so my code looks something like this:
function obj1 (){
this.property1 = "propvalue";
this.dosomething = function () {
// does some processing
}
this.drawhtml = function () {
// outputs html
}
}
// jquery to handle events
$(document).ready(function(){
// .edit is a class in the html outputted from the drawhtml
$('body').on('click','.edit',function () {
// call the dosomething from the object
});
});
// create instance of object could be multiple on on page
var instance1 = new obj1;
instance1.drawhtml();
Thanks,