
Jin Yong
Weiß jemand, wie ich alle Werte in der Auswahl von Jquery erhalten kann?
Beispiel:
<select name="group_select" id="group_select">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
Ich möchte alle Optionswerte (a, b und c) von select (ohne ausgewählte Option) mithilfe von jquery abrufen
var values = $("#group_select>option").map(function() { return $(this).val(); });
Im Folgenden erhalten Sie ein Array der <option>
Werte
var values = $.map($('#group_select option'), function(e) { return e.value; });
// as a comma separated string
values.join(',');
Hier ist ein Arbeitsdemo. hinzufügen /bearbeiten auf die URL, um den Code zu sehen.

helloandre
This will iterate through all the options and give you their values.Then you can either append them to an array or manipulate them individually.
$('#group_select option').each(function(){
$(this).val()
};
You can use following code for that :-
var assignedRoleId = new Array();
$('#RolesListAssigned option').each(function(){
assignedRoleId.push(this.value);
assignedRoleId.push(this.text);
});
11446400cookie-checkWie bekomme ich alle “Option” -Werte in “Select” von Jquery?yes
mögliches Duplikat von How to get all options of a select using Jquery?
– PhoneixS
9. Juli 2013 um 10:24 Uhr