I have a button, when you click this button it dynamically creates a second button. I need to place a click event on to the dynamically created button (second button), which I do, but my click function isn't working.

How can I get my click function to work with dynamically created elements?