Hi there,
I append some HTML retrieved as part of a JSON payload and then append it to a div called #content.
That's fine, the HTML retrieved is appended with $("#content").append(data.html_result); and it appears as expected.
I then run a function which should refresh the click actions etc. on the page. It works fine, and the buttons on the newly created element become clickable etc.
But on click of buttons that use .prev() and .next() - they can't find the adjacent elements.
In the click function, if I loop over the elements after the dynamically added element is placed and alert what's found, the dynamically created element is included in the elements returned so jquery can 'see' that it is now there as far as I can tell.
So alerting $("#" + thisID).prev().attr('id') works fine for div elements that were loaded at page load. But if I execute that for the dynamically added one, it's blank.
I'm very confused... Any help appreciated!