Altering a Generated Template After It Renders

Sometimes, what comes out of an expanded bright template via a Bright shortcode is close, but not quite right.

Using the after_load javascript hook, you can use jQuery to make last second adjustments to generated Dom Elements.

For example, I put this inline into my WordPress post [using text mode]:

[bright class="none" type="generic" template="bright_results_matrix"]

<script>
Bright.addHook('after_load',function() {
  setTimeout(function () {
    jQuery("table.bright-results-matrix").each(function () {
      jQuery('div#secondary').css('display','none');
      jQuery(this).css('background','white');
    });
  });
});
</script>

[/bright]

Using the Bright JS hook ‘after_load’, we modify the CSS of the generated table! HOT