fixed display issue with select dropdown
This commit is contained in:
parent
a6a7fbade6
commit
4ccb8ac05e
@ -12,7 +12,7 @@ the_header(
|
||||
?>
|
||||
|
||||
<div id="recipe-id" hidden><?= $context['recipe']->get_id() ?></div>
|
||||
<div id="in-usermenu" hidden></div>
|
||||
<div id="in-usermenu" hidden><?= $context['recipe']->in_usermenu; ?></div>
|
||||
|
||||
<div class="container">
|
||||
<div class="single-recipe">
|
||||
|
||||
@ -15,7 +15,16 @@ document.addEventListener('click', (e) => {
|
||||
|
||||
|
||||
const options = document.querySelectorAll('.dropdown-item');
|
||||
const inUsermenu = document.getElementById('in-usermenu').textContent;
|
||||
|
||||
if (inUsermenu) {
|
||||
options.forEach(option => {
|
||||
if (option.getAttribute('data-value') === inUsermenu && option.getAttribute('data-value') !== 'remove') {
|
||||
option.classList.add('dropdown-selected');
|
||||
toggleBtn.textContent = option.textContent;
|
||||
}
|
||||
});
|
||||
}
|
||||
options.forEach(option => {
|
||||
option.addEventListener('click', async (e) => {
|
||||
const selectedValue = option.getAttribute('data-value');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user