JSFiddle - React, Tailwind, and code Playground

by Sean Xu

HTML

<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js"></script>
<link rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css">
<div class="sg-section-code">
    <pre class="brush: js;">
        <div class="placeholder" data-load="/echo/html">aaaa</div>
    </pre>
</div>

JavaScript

function loadScript(placeholder){
  var $p = $(placeholder);
  var deferred = $.Deferred();
  $p.load($p.data('load'),function(){
      console.log('success');
    deferred.resolve();
  });
  return deferred;
}

$(function(){
  var q = [];
  $('.placeholder').each(function(item){
    q.push(loadScript(this));
  });
  console.log(q);
  $.when.apply($, q).done(function(){
    console.log('success');
    SyntaxHighlighter.all();
  });
});