add document, fix tooltip position issue
This commit is contained in:
@ -18,6 +18,9 @@ function createCheckbox(opts) {
|
||||
container.className = 'checkbox-wrapper';
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('type', 'checkbox');
|
||||
if (opts.checked === true) {
|
||||
input.checked = true;
|
||||
}
|
||||
if (typeof opts.onchange === 'function') {
|
||||
input.addEventListener('change', opts.onchange);
|
||||
}
|
||||
@ -64,6 +67,13 @@ function resolveCheckbox(container) {
|
||||
box.removeAttribute('data-label');
|
||||
}
|
||||
const input = document.createElement('input');
|
||||
const id = box.getAttribute('data-id');
|
||||
if (id != null && id.length > 0) {
|
||||
input.id = id;
|
||||
}
|
||||
if (box.getAttribute('data-checked') != null) {
|
||||
input.checked = true;
|
||||
}
|
||||
input.setAttribute('type', 'checkbox');
|
||||
box.insertBefore(input, box.firstChild);
|
||||
}
|
||||
|
Reference in New Issue
Block a user