廣告

2015年9月8日 星期二

get index of selected option with jQuery


//Just use the selectedIndex property of the DOM element:

 alert($("#dropDownMenuKategorie")[0].selectedIndex);

//reason:
// property. Adding [0] converts the jquery object 
to a javascript object which has the selectedIndex property. 
This example won't work without [0] 


more detail about selectedIndex
http://www.w3school.com.cn/jsref/prop_select_selectedindex.asp

Purpose:
as title

沒有留言:

張貼留言