Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Loading new content via Ajax
06-10-2014, 11:08 AM #1
- Join Date
- Nov 2010
- Thanked 1 Time in 1 Post
Loading new content via Ajax
JS Fiddle: Edit fiddle - JSFiddle
I've been doing extensive work on this and I've just able almost got it fully working. The reason why I am asking for help now is that I don't have a clue why my newly added accordion(s) do not expand upon being clicked.
I've got a feeling it may be due to the newly added code as I was having problems using my code in the file so instead I looked at the source and copied the accordion level to be used and all appears to look fine apart from them not expanding.
I've been told that this does not work because it does not exist upon the sortable code initializing and therefore I need to use Ajax, however I haven't a clue how to do this using Ajax and kindly ask for some help in doing so.
Thank you for any help in advanced,
Best Regards, Tim
06-12-2014, 02:52 AM #2
- Join Date
- Aug 2009
- Jakarta, Indonesia.
- Thanked 56 Times in 55 Posts
I don't know the reason, but it looks like jQuery UI's accordion hasn't been able in "cloning" event-handlers to the new elements.
There's a method called .refresh() in accordion, which (according to its doc.) should solve this, but sadly it doesn't. So I played a a little longer with your fiddle, and added 2 lines to this event-handler of yours:
as follows:Code:$(AddButton).click() //on add input button click
- to the very start, just destroy accordion first ...with this:Code:InputsWrapper.accordion('destroy');
- then right before returning false, add this:Code:create_accordian(InputsWrapper);