generated at
<template>



HTML上でCusomt Element風なものを書いて、それをJS(Custom Element)で読み込んで使う
html
<template id="my-button"> <img src=""> <button type="button"></button> </template>
js
const template = document.querySelector("#my-button"); const clone = document.importNode(template.content, true); clone.querySelector("button").innerText = "my button"; document.body.appendChild(clone);

<template>は何が嬉しいのかわからん
普通にJS内に書けばいいじゃん
なんでわざわざglobalなhtml上に書くのかわからん
わかるmrsekut