Skip to content

Async behaviour, refreshing the DOM #3

@misterpo

Description

@misterpo

Hi,

I am trying to define 2 shortcode classes, the second one uses content generated by the first one.
I guess I have to refresh the DOM after the first class has been called, but I can't get it to work.

Here is my code 👍

$('#content-wrapper').shortcode({

   accordions: function(done) {
   //var $html = $($('this').html());
   var $text = "<div class='accordion'><ul class='resp-tabs-list'></ul><div class='resp-tabs-container'></div>";

   /* setTimeout is used here to simulate an async event */
    setTimeout(function() {
      done($text);
    }, 1000);
//return $text;

      },

      accordion: function(done) {
      var $text = "<i class='icon-info-sign'></i>" + this.options.title;

        var $toc = $($('.resp-tabs-list').html());

          $toc.find('ul').append(
            $('<li>'), {
              text: $text
            });

            return $toc;
 }); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions