How to Jquery calling on page load?


(kurosaki kenji) #1

First I’m sorry I did not speak English well.

<script type="text/discourse-plugin" version="0.4">
api.onPageChange((url, title) => {
$('.cooked').each(function(){
    var $this = $(this);
    var t = $this.text();
    $this.html(t.replace(/\&lt\;img\ssrc=\"(.+?)\"\/\&gt\;/igm, "<img src=\"$1\""));
});
});
</script>

html tag issue, I could not get a tumbler image,
I’m trying to modify the html tag(&lt; -> “<”) with a regular expression.
When I use the above code, jquery is not loaded at first.
But when i refresh the page, the image is displayed normally.

Why can not load jquery right away??
How do I modify the code?
plz help me!