jQuery get select dropdown list selected item index

When learning how jQuery gets the selected text and value of the select, I found that I can also get the index of the selected item, so I searched and recorded it.
$('#selectOne').find('option:selected').selectedIndex;
$('#selectOne).find('option:selected').attr('selectedIndex');
The above two methods cannot obtain the index value, and the following four methods can obtain the index value of the selected item after testing.
$("#selectOne").get(0).selectedIndex;
$('#selectOne').prop('selectedIndex');
$('option:selected', '#selectOne').index();
$('#selectOne option').index($('#selectOne option:selected'));

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326611477&siteId=291194637