Can anyone help me with this? Note: Project is a dynamic Webflow website, so the entries get generated as described below, I can only change class names
Let's say I have multiple items I want to append to a select field
<div class="item-category">Kitchen</div>
<div class="actual-item">Spoon</div>
<div class="item-category">Living room</div>
<div class="actual-item">Sofa</div>
<div class="item-category">Kitchen</div>
<div class="actual-item">Plate</div>
I'm able to append items using actual-item class
$('.actual-item').each(function(){
var s=$(this).text();
$('.item-select-field').append('<option value="'+s+'">'+s+'</option>');
})
But I want to have option value equal to corresponding item-category (so I could filter items out later).
Is there any way to do this?
I've thought of changing the item-category class to actual-item and then using only even elements as option-value but I don't know to do this.