Home > database >  HTML element added to the DOM as a string
HTML element added to the DOM as a string

Time:03-17

I've got a jsFiddle here to demonstrate the issue:

enter image description here

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>');
    });
  • Related