ILearner
ILearner

Reputation: 131

How to dynamically change the Accordion elements in materialize's CSS?

I need to change the accordion elements dynamically, while clicking click Here to next accordion button need to activate next accordion elements. But I tried many ways doesn't work anything. Can you please suggest me?

JSFiddle here

    $('.collapsible').collapsible();
      $('.next-accordion').on('click', function(){
      $('#scondId').click();
      $('#scondId').trigger('click');
     });

Upvotes: 2

Views: 924

Answers (1)

Jai
Jai

Reputation: 74738

Instead of triggering it on li's id trigger it on the child element:

$('#scondId > div').click();

Demo fiddle.

Upvotes: 1

Related Questions