I'm trying to make an edit mode when clicking on an "Edit" button. The mode should create a Save-button, a Delete-button and maybe something more.
I'm using jQuery to create the buttons and I'm trying to assign events to them, but the event handler gets fired when I assign it. I've read something about event propagation is the problem, but I can't seem to figure out how to solve it.
Not only does it get triggered, when I try to click the new button, the event is not fired.
Here's an isolated example of my problem: https://codepen.io/anon/pen/ooxQXR
I've tried several methods of interupting the propagation, but nothing seems to work.
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
Any ideas on how to solve this?