oh well.
Jun 10, 2024
6
Level 1
drop-down
so I was trying to click a dropdown option of a site there is the code :
<ul class="select2-results" role="listbox" id="select2-results-8">
<li class="select2-results-dept-0 select2-result select2-result-selectable select2-highlighted" role="presentation"><div class="select2-result-label" id="select2-result-label-269" role="option">
<span class="select2-match">Good</span></div></li>
<li class="select2-results-dept-0 select2-result select2-result-selectable" role="presentation">
<div class="select2-result-label" id="select2-result-label-270" role="option">Very
<span class="select2-match">Good</span></div></li></ul>
I have used click(), key down, key up, and event handler it only returns undefine. somehow I managed to open the drop menu but I can't click on the option Mainly they have used the input tag, not a select tag so I can't use selectedindex also not working. I am new to these topics .somebody have any idea how can we do this?:)
Level 1
@gych To open the options and enter the value, I'm using:
const input =document.querySelector("#s2id_autogen8") #input box id
input.value = 'Good' #option need to search on dropdown
const event = new Event('input', {
bubbles: true,
cancelable: true,
})
input.dispatchEvent(event)
also, I have tried using "change" not working for selecting an option
1 like
Please or to participate in this conversation.