domassist
Version:
Various dom helpers
17 lines (14 loc) • 334 B
JavaScript
import find from './find';
function html(selector, value) {
if (Array.isArray(selector)) {
selector.forEach((item) => html(item, value));
}
const el = find(selector);
if (el.length) {
const length = el.length;
for (let i = 0; i < length; i += 1) {
el[i].innerHTML = value;
}
}
}
export default html;