question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Collapsible don't expand

See original GitHub issue

Hi everyone! I’m doing my first steps with Materialize. I want to generate a dynamic list from an XML file. The problem I have is that the results are not expanded. Here’s the code:

$(document).ready( function() {
   $('#term').keyup( function() {
      $.get('search_xml.php?q='+escape($('#term').val()), function(data) {
         html = '<div id="results"><ul class="collapsible" data-collapsible="accordion">';
     $(data).find('tarifa').each( function() {
        var ep = $(this);
        html += '<li>';
        html += '<div class="collapsible-header"><i class="material-icons">place</i>'+ep.attr('localidad')+'</div>';
        html += '<div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>';
        html +=  '</li>';
         } );
     html += '</ul></div>';
     $('#results').replaceWith( html );
         } );
      } );

   $('.collapsible').collapsible({
      accordion : true
    });

Can you help me? Thank you in advance. Sergio

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
filippolcrcommented, Dec 2, 2015

I’ve the same problem! I’ve solved removing:

$('.collapsible').collapsible({
      accordion : true
    });
2reactions
blahahcommented, Dec 16, 2015

for dynamic content you need to call

$('.collapsible').collapsible({
  accordion : true
});

every time the content is updated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collapsible not expanding - javascript - Stack Overflow
When clicking the div, I want the collapsed content to expand. ... the first time your script is fired, there is no var...
Read more >
Collapse or expand parts of a document - Microsoft Support
To collapse or expand all the headings in your document, right-click the heading and click Expand/Collapse > Expand All Headings or Collapse All...
Read more >
Video: Collapsible headings - Microsoft Support
You can quickly add an outline level and make part of your document collapsible by adding a heading using Word's built-in styles. Collapse...
Read more >
Collapse - Bootstrap
If you've set the collapsible element to be open by default using the show class, set aria-expanded="true" on the control instead. The plugin...
Read more >
Unable to use collapsible/expand markdown - support - HUGO
No html inside (I copied and pasted the example you gave), so I thought it's because of the html or the shortcode html-like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found