Created
June 7, 2011 09:01
-
-
Save cognitom/1011927 to your computer and use it in GitHub Desktop.
jQueryで、選択済みチェックボックスの値のリストを取得するワンライナー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<input type="checkbox" name="sample[]" value="1" checked="checked" /> | |
//<input type="checkbox" name="sample[]" value="2" /> | |
//<input type="checkbox" name="sample[]" value="3" checked="checked" /> | |
var str = $('input:checkbox[name="sample[]"]:checked').map(function(i){ return this.value }).get().join(', '); | |
alert(str);//1, 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment