I want to do some actions when a button on my page is clicked, but my function executes without clicking on the button and when I check the log using firebug I got "undefine" message. Below is my code snippet so far.
var email = example@example.com
"<button class='btn btn-warning' onclick ='"+addNote(email)+"' >Add Note</button>"
function addNote(youremail){
alert("Your email is "+ youremail);
}
With the above code snippet the output will be Your email is example@example.com.