如何使用jQuery获取select的所有选项? [英] How to get all options of a select using jQuery?
本文介绍了如何使用jQuery获取select的所有选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过传递其ID来获取select jQuery的所有选项?
How can I get all the options of a select through jQuery by passing on its ID?
我只想获取它们的值,而不是文本。
I am only looking to get their values, not the text.
推荐答案
使用:
$("#id option").each(function()
{
// Add $(this).val() to your list
});
这篇关于如何使用jQuery获取select的所有选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文