checkedbox 컨트롤

· 10년 전 · 305

// [ checkedbox 컨트롤 ] --------------------------------------------------------------///
1. 개수 구하기
$("input[name=chk1]:checkbox:checked").length
 
☆☆☆  php에서 배열사용시  ☆☆☆
$("input[name='chk1[]']:checked").length
 
 
2. 체크여부 확인
$("#check_all").is(':checked')
 
 
3.  chk1 개수만큼 돌면서 실행한다
 
  $("input[name='item[]']:checkbox:checked").each(function(){items.push($(this).val());}); 
 
  var items_str = items.join(',');
 
  또는 var items_str = items.toString();
 
  또는 var items_str = $("input[name='item[]']:checkbox:checked").map(function () {return this.value;}).get();
 
  
4. disabled 하기
 
$("input[name=chk1]").attr('disabled', 'true');

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
10년 전 조회 216
10년 전 조회 298
10년 전 조회 258
10년 전 조회 264
10년 전 조회 264
10년 전 조회 283
10년 전 조회 279
10년 전 조회 759
10년 전 조회 242
10년 전 조회 263
10년 전 조회 169
10년 전 조회 705
10년 전 조회 306
10년 전 조회 284
10년 전 조회 343
10년 전 조회 353
10년 전 조회 383
10년 전 조회 259
10년 전 조회 166
10년 전 조회 263
10년 전 조회 193
10년 전 조회 211
10년 전 조회 177
10년 전 조회 228
10년 전 조회 235
🐛 버그신고