I'm trying to replace a divs content with jQuery's .html() function and within that new content i want to create a button, containing an ID that i can access from another function.
$('#content').html("<div style='padding: 10px;'>"
+ " <input class='btn btn-primary' value='Button' id='button'> </input>"
+ "</div>");
After this i got another function that tries to access the button:
$('#button').click(function(e){
//... do something
});
I inspected the generated button in Chrome and it tells me that it has the right ID but somehow nothing happens when i try to trigger it?
Any solutions on that? Thanks in advance.