Inital commit
This commit is contained in:
commit
a6af7dbfcb
114 files changed
+27520
No files matched your search
@@ -0,0 +1,26 @@
|
||||
document.querySelectorAll('.icon-select').forEach(select => {
|
||||
const trigger = select.querySelector('.icon-select-trigger');
|
||||
const options = select.querySelector('.icon-options');
|
||||
const hiddenInput = select.querySelector('input[name="icon"]');
|
||||
|
||||
trigger.addEventListener('click', () => {
|
||||
options.style.display = options.style.display === 'block' ? 'none' : 'block';
|
||||
});
|
||||
|
||||
options.querySelectorAll('.icon-option').forEach(option => {
|
||||
option.addEventListener('click', () => {
|
||||
const id = option.dataset.id;
|
||||
const name = option.dataset.name;
|
||||
|
||||
hiddenInput.value = id;
|
||||
|
||||
if (name) {
|
||||
trigger.innerHTML = `<img src="/assets/images/${name}" alt="">`;
|
||||
} else {
|
||||
trigger.innerHTML = `<span style="color:#bbb;">None</span>`;
|
||||
}
|
||||
|
||||
options.style.display = 'none';
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user