kswedberg / jquery-expander

Expand and Collapse HTML content
https://kswedberg.github.io/jquery-expander/
Other
459 stars 168 forks source link

not working when i set data using ajax #123

Closed socialinfotech215 closed 4 months ago

socialinfotech215 commented 6 years ago

not working when i set data using ajax so how can i solve this issue?...

kswedberg commented 6 years ago

I'm not sure exactly what the circumstances are. If you could provide some code that shows the problem, that would be helpful.

One thing to note, though, is that the content has to be in the document before you can act on it. So if you are inserting content with ajax, you should call .expander() on that content in a callback after it has been inserted. Something like:

$.ajax('/some/content')
.then(function(html) {
  $(html).appendTo('#mydiv');
  $('#mydiv').find('.something-to-expand').expander();
})
socialinfotech215 commented 6 years ago

thanks its working... but how can i stop load content when first time page load...??