我想獲取所有選中複選框的名稱。我試過這個:如何使用jQuery檢索所有選中複選框的名稱?
$("#movebutton").click(function() {
var selectedids = "";
alert($('.checkbos_gruppe[checked=checked]').attr("name"));
});
有沒有人有更好的主意?
我想獲取所有選中複選框的名稱。我試過這個:如何使用jQuery檢索所有選中複選框的名稱?
$("#movebutton").click(function() {
var selectedids = "";
alert($('.checkbos_gruppe[checked=checked]').attr("name"));
});
有沒有人有更好的主意?
使用:
var names = $('.checkbos_gruppe:checked').map(function(index, elem) {
return this.name;
}).get();
'names'將是一個jQuery對象;) – 2010-12-11 11:07:42
yay,如果您經常使用'.map()'方法,則會發生:p fixed;) – jAndy 2010-12-11 11:13:04
thx !!!工作正常 – 2010-12-11 11:08:46