I am trying to active function when clicking on button which is created with createElement
.
On html code:
<fieldset class="form-fieldset">
<button type="button" class="btn-ref">Hello</button>
</fieldset>
On javascript:
$('.btn-ref').click(function(){
var newButton = document.createElement('button');
newButton.className="btn-ref";
$('.form-fieldset').append(newButton);
});
On original code, when clicking on button does create new button. But after clicking on created button, it does not create new button.
Can someone tell me what is wrong?