在下拉列表中获取所选选项的值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在下拉列表中获取所选选项的值相关的知识,希望对你有一定的参考价值。

This snippet gets the value of the selected dropdown
  1. jQuery.fn.selectedLabel = function()
  2. {
  3. return this.find(':selected').html();
  4. }
  5.  
  6.  
  7. Then you can access the text from a selected option within a select:
  8. var text = $('select#month').selectedLabel();

以上是关于在下拉列表中获取所选选项的值的主要内容,如果未能解决你的问题,请参考以下文章