Answer the question
In order to leave comments, you need to log in
How to implement syntax highlighting on a web page when changing the content of tags?
Good afternoon.
There is json in tags <pre><code></code></pre>
. I do syntax highlighting using prism.js .
JSON is returned after running some program.
If you write it there right away, then everything is perfectly highlighted. But after the json in the tags has been overwritten by some program (which returns json), the syntax is no longer highlighted.
The question is. Tell me, is it possible to restart the script after the content has changed <code></code>
?
I know that jQuery has a .change() method, but it doesn't work with these tags.
Thanks in advance. I am not an expert and I just want to modify the application interface for myself, let's say, for aesthetic pleasure.
Answer the question
In order to leave comments, you need to log in
Does prism.js even have a method for reinitialization?
Probably, it would be more correct to start highlighting not when tags are changed, but upon successful completion of an ajax call that changes tags.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question