I am building a portal interface in jQuery (and UI). Each portlet has a sortable drag handle which each feature roll-up/down and close links on hover.
I use server-side scripting to build the page on first load. All the drag/rollup/close events are recorded in a DB using ajax, so that the next time the page is hard-loaded the portlets are displayed as they were left. There is also a 'customise this page' link which dynamically adds portlets to the DOM on an event. The portlet code is identical to that used on hard-load, only this time the code is prepended to an existing DOM element. All the jQuery stuff (sorting, roll-up etc.) works properly when the content is 'hard-loaded'. However, when adding portlets to the DOM on an event, all the clever jQuery stuff doesn't work. I'm not sure, but I believe this is because the config javascript waits until $(document).ready. This happens on 'hard-load' but has no effect on DOM stuff added after this. How would you recommend I re-invoke the jQuery javascript after adding a dynamic element to the DOM? Thanks for your help. Regards, Steve