function dostuff() {
$("#element").append("<div id='e1'>approve</div>");
$("#element").append("<div id='e2'>deny</div>");
$("#element #e1").click(function() {
return "e1";
});
$("#element #e2").click(function() {
return "e2";
});
}
alert(dostuff());
I'd like to make a function that wait's with returning something until the user has done an action. like above. I'd like the function to return e1 if the user clicked on the e1 element.
Is this possible? If not, what is the proper alternative manner to get this done?