Closed mkfizi closed 1 year ago
Resolved by wrapping entire element in div then redraw elements using div as below
<div
x-data: {
code: '<p>Changed<p>'
}
x-init="
setTimeout(() => {
div = document.createElement('div');
div.innerHTML = `<pre><code data-language="html">${code}</code></pre>`
Rainbow.color(div, function() {
$el.innerHTML = '';
$el.appendChild(div)
});
}, 1000)
"
>
<pre><code class="text-sm" data-language="html"><p>Start<p></code></pre>
</div>
I have html code below combined with Alpinejs
After 1 second the output doesnt follow rainbow format anymore. How to retrigger rainbow for when the content is changed?