I am trying to build a site where I show general JavaScript code snippets for various scenarios. I want to show the code from selected JavaScript file inside HTML ( not execute, just show ). I tried loading file using jQuery load function
$('#code-block').load('./JSSnippets/testCode.js');
& then used Prism library to highlight syntax
Prism.highlightAll();
The problem is when you load JavaScript content dynamically inside div, Prism doesn't render it properly.(It renders it properly only when JavaScript code is hard coded in the div). Is there a simple solution for this scenario ?