Created
June 17, 2016 15:32
-
-
Save theredstapler/c5991d5b09a76b68a808fd0f84f402c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="jquery.min.js"></script> | |
| <link rel="stylesheet" href="styles/default.css"> | |
| <script src="highlight.pack.js"></script> | |
| </head> | |
| <body> | |
| <pre><code class="javascript">var test; | |
| alert(1+1);</code></pre> | |
| <input id="b" type="button" value="highlight!" /> | |
| <script> | |
| $('#b').click(function(){ | |
| $('code').removeClass('javascript'); | |
| $('code').addClass('C'); | |
| hljs.highlightBlock($('code').get(0)); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to change code theme with a button click using highlight.js