Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// 아래와 같은 HTML Table Code 를 가정하고
<th><input type="checkbox" name="_selected_all_"></th>
<td><input type="checkbox" name="_selected_" value="ROW_1"></td>
<td><input type="checkbox" name="_selected_" value="ROW_2"></td>
<td><input type="checkbox" name="_selected_" value="ROW_3"></td>
<td>Good Luck!</td>
// 전체선택 및 해제 기능은..
$('input[name=_selected_all_]').on('change', function(){
$('input[name=_selected_]').prop('checked', this.checked);
// 선택한 Checkbox 값을 가져오는 방법은...
var arr = $('input[name=_selected_]:checked').serializeArray().map(function(item) { return item.value });
//var str = $('input[name=_selected_]:checked').serialize(); // 이건 QueryString 방식으로
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment