14 lines
477 B
JavaScript
14 lines
477 B
JavaScript
function create_notice(id, type, mesg) {
|
|
let container = document.createElement('div');
|
|
container.id = id;
|
|
container.classList.add('notice', `notice-${type}`, 'settings-error', 'is-dismissible');
|
|
container.innerHTML = `<p><strong>${mesg}</strong></p>`;
|
|
return container;
|
|
}
|
|
|
|
export function show_notice(target, type, mesg) {
|
|
target.querySelectorAll('.notice').forEach(x => x.remove());
|
|
const notice = create_notice('test', type, mesg);
|
|
target.prepend(notice);
|
|
}
|