jQuery如何获取所选索引

jQuery如何获取所选索引,jquery,select,indexing,Jquery,Select,Indexing,我有一些建议: <select name="serviceID[1]" id="serviceID[1]" class="computeThisService"> <option value="" selected="selected">No Selection</option> <option value="4">TJ5</option> <option value="1">TJ2</option> <o

我有一些建议:

<select name="serviceID[1]" id="serviceID[1]" class="computeThisService">
<option value="" selected="selected">No Selection</option>
<option value="4">TJ5</option>
<option value="1">TJ2</option>
<option value="5">TJ1</option>
<option value="2">TJ3</option>
</select>

您可以使用
selectedIndex

$("#serviceID\\[1\\]")[0].selectedIndex

您可以使用
selectedIndex

$("#serviceID\\[1\\]")[0].selectedIndex

您可以使用
selectedIndex

$("#serviceID\\[1\\]")[0].selectedIndex

您可以使用
selectedIndex

$("#serviceID\\[1\\]")[0].selectedIndex

对于jQuery,您只需要以下内容-

$('select option:selected').text();
所以在你的情况下,它可以是

$('#serviceID\\[1\\] option:selected').text();

对于jQuery,您只需要以下内容-

$('select option:selected').text();
所以在你的情况下,它可以是

$('#serviceID\\[1\\] option:selected').text();

对于jQuery,您只需要以下内容-

$('select option:selected').text();
所以在你的情况下,它可以是

$('#serviceID\\[1\\] option:selected').text();

对于jQuery,您只需要以下内容-

$('select option:selected').text();
所以在你的情况下,它可以是

$('#serviceID\\[1\\] option:selected').text();

我尝试得太早了,但它在@Felix不起作用。但是我会再试试的,小伙子,这对我有帮助,兄弟:-)我试得太早了,但它不起作用@Felix。但是我会再试试的,小伙子,这对我有帮助,兄弟:-)我试得太早了,但它不起作用@Felix。但是我会再试试的,小伙子,这对我有帮助,兄弟:-)我试得太早了,但它不起作用@Felix。但是我会再试试的,伙计,这对我有帮助