jquery獲得select選中索引


      select選中索引有好多方式,
這兩種方式取不到索引值這兩種方式取不到索引值這兩種方式取不到索引值這兩種方式取不到索引值
$('#someId').find('option:selected').selectedIndex;
$('#someId').find('option:selected').attr('selectedIndex');
這兩種方式取不到索引值
 
 
$('#someId').prop('selectedIndex');
$('option:selected', '#someId').index();
$('#someId option').index($('#someId option:selected'))
以上三種方式可以取到索引值


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM