<div x-data="{ code: '<p>Dynamic Paragraph</p>' }">
    <div x-ref="sentence">I am a sentence</div>
    <button @click="$refs.sentence.innerText = 'I just changed'">Change Sentence</button>
</div>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/alpinejs/2.8.0/alpine.js