mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
23 lines
401 B
JavaScript
23 lines
401 B
JavaScript
|
|
export function createElement(type, id, className, text) {
|
|
const el = document.createElement(type);
|
|
if (id) {
|
|
el.id = id;
|
|
}
|
|
if (className) {
|
|
el.className = className;
|
|
}
|
|
if (text) {
|
|
el.innerText = text;
|
|
}
|
|
return el;
|
|
}
|
|
|
|
export function select(query) {
|
|
return document.querySelector(query)
|
|
}
|
|
|
|
export function selectAll(query) {
|
|
return document.querySelectorAll(query)
|
|
}
|
|
|