drop-down( programmatically selecting a option in drop-down menu

  Kiến thức lập trình

so I was trying to click a dropdown option of a site there is the code :

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?:)

New contributor

J Mahendran is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT