Is it possible to append a button with a id to a div and then give it a mouseclick event later in the code? I was trying it out and it wouldn't work.
html:
<body>
<input type="button" id="button" value="Click me"/>
<div id="add"></div>
</body>
js:
$('#button').click(function() {
$('#add').append('Hi, I am a button. <input type="button" id="new_button"');
});
$('#new_button').click(function() {
alert('Hello');
});