I’m trying to use javascript and jquery to do some plotting, here is the code that I define the button, but the first time I click it doesn’t work, the second time it works well, I don’t understand why.
$('<p><input type="button" value="Plot Data" /></p>').click(getData).appendTo('#plot');
Could someone help to explain it?
Thanks!
Mengfei
example
EDIT for comments
example update