I'm sorry, I still fresh with Javascript. May I know how to pass the Object variable through onClick into the function ?
The code below is my Object:
var myObject = {
id : id,
email : email,
name : name,
type : type
};
The code below I use to append:
$('#main-container').append(
'<div>'+
'<button onclick="passObject('+myObject+')">Submit</button>'+ //how to pass myObject here, I know I pass wrongly ps
'</div>');
The myObject value in function is String type, Besides that, when I get value from object:
function passObject(myObject){
console.log(myObject); // [object Object]
console.log(myObject.email); //undefined
}