Just starting out with riot.js and I have a question that may seem obvious.
When I statically add a tag and then mount it, everything works perfectly. But when I try to dynamically add a tag using JavaScript, nothing shows up. I believe I need to somehow mount the newly created element, but I'm not sure how to do this.
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.6.7/riot+compiler.min.js"></script>
<body>
<h1>
testing riot.js
</h1>
<ol id="list">
<li>
<example></example>
</li>
<li>
<example></example>
</li>
</ol>
<button onclick="addTag()">Add tag</button>
<script type="riot/tag">
<example>
<p>Welcome to Riot.js</p>
</example>
</script>
<script>
riot.mount('example');
function addTag(){
var list = document.getElementById("list");
var li = document.createElement('li');
list.appendChild(li);
var tag = document.createElement('example');
li.appendChild(tag)
}
</script>
</body>