Jquery Append and then remove
I am using the append method to add html to the page. This works perfectly, however when appending that html I also need to append a remove button. It will append the button however it does not work, it wont remove the element.
If I hard code the remove button in it works, but when appeneded nothing happens.
I have a JSfiddle,
When you click on 'Refund Item' the words 'Hello' followed by 'Take it' appear. The take it when clicked should remove the 'Hello' element, but it does not. Ny ideas??
adding a simple click listener to an element will only work if the element exists at the time that the code is run. To add a listener to an element that doesn't exist yet, one solution is to delegate the event:
fantastic, thanks for that!
|All times are GMT +1. The time now is 04:24 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.