mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-04-02 20:15:53 +02:00
* :tap: removed on.attributeChanged and static observedAttributes * ⚡ import optimalization * ⚡ scope.signal * 🔤 🐛 * ⚡ 🐛 registerReactivity and types * 🔤 * ⚡ * 🔤 * 🐛 Node in enviroment * ⚡ todos * ⚡ * ⚡ 🔤 * ⚡ lint * ⚡ memo * 🔤 🐛 memo * ⚡ 🔤 todomvc * 🐛 types * 🔤 p08 signal factory * 🔤 ⚡ types * ⚡ 🔤 lint * 🔤 * 🔤 * 🔤 * 🔤 * 📺
20 lines
418 B
JavaScript
20 lines
418 B
JavaScript
// Create element with properties
|
|
const button = document.createElement('button');
|
|
button.textContent = "Click me";
|
|
button.className = "primary";
|
|
button.disabled = true;
|
|
|
|
// Or using Object.assign()
|
|
const button2 = Object.assign(
|
|
document.createElement('button'),
|
|
{
|
|
textContent: "Click me",
|
|
className: "primary",
|
|
disabled: true
|
|
}
|
|
);
|
|
|
|
// Add to DOM
|
|
document.body.append(button);
|
|
document.body.append(button2);
|