[jQuery] How to determine when an element finishes rendering?
I'm working on a page for my company that allows us to edit
information in page, and then write that page out to a file (or a
database, or whatever).
The process we have right now is as follows:
The html in the 'editor' section gets copied out to a hidden element.
Undesirables are removed from the html in the hidden element (removing
various js calls, or unwanted elements)
The HTML content of the hidden element are sent to the server via ajax
and written wherever.
The trouble that I'm having is that I can't put it all in a single
function. I can copy the data over to the hidden element, but the
browser needs to render the data before jQuery can access it. By the
time the render is complete the remove function and the AJAX call have
already been executed.
Implementing a setTimeout doesn't make much sense as it delays the
script from running, but there's no guarantee that when the timeout is
up, the element will have finished rendering.
Is there any way I can tell when the element has finished rendering
it's contents? Anyone have any alternative suggestions?