作品一覧に戻る
物体を召喚せよ

物体を召喚せよ

松谷一希 04/03 11:58
アプリを動かす
コードを見る
<!DOCTYPE html>
<html>
 <body>
  <button id="summonBtn">召喚!</button>
  
  <div id="stage"><p id="count"></p></div>
 </body>
</html>
const btn = document.querySelector('#summonBtn');
const stage = document.querySelector('#stage');

btn.addEventListener('click', function() {
  const spirit = document.createElement('p');
  spirit.textContent = '✨ 精霊が現れた!';
  stage.appendChild(spirit);
});