I've got a jsFiddle here to demonstrate the issue:
Notes: I'm using 'on' as the input will be dynamically added to the DOM after the page has rendered.
CodePudding user response:
Edit: Thanks for the comments and the hints.
Just wrap "this" into a jquery selector and it will work as expected:
https://jsfiddle.net/q85pfmex/
function(e) {
$(this).after('<button id="fooBar">add user</button>');
});