일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- JavaScript
- selinux
- iframe
- 자바스크립트
- 구글뷰어
- 301 리다이렉트
- JS
- MySQL
- 페이지전환효과
- ip직접접근차단
- 정규식
- 우분투
- Ajax
- 리사이즈
- .htaccess
- SSL
- 글자 수 제한
- 디지털 정부서비스ui/ux
- virsualhost
- Vanilla JS
- 우분투 npm 설치
- 배열
- 날짜비교
- 글자수제한
- post_type
- 날짜변환
- 애니메이트
- 정부 서비스 가이드라인
- 보안인증서
- 비동기호출
- Today
- Total
더 나은 프로그래머가 되자
JQuery 라디오 radio 체크박스 checkbox 컨트롤 본문
1. JQuery checkbox 컨트롤
1) checkbox checked 여부
id 인 경우 : $('input:checkbox[id="checkbox_id" ]').is(":checked") == true;
name인 경우 : $('input:checkbox[name="checkbox_name"]').is(":checked") == true;
2) checkbox 전체 갯수 : $(".class_name").size();
3) checkbox 선택된 갯수 : $(".class_name:checked").size();
4) checkbox 전체 순회 하며 checked 처리
$('input:checkbox[name="checkbox_name"]').each(function() {
this.checked = true;
// if ( $(this).is(":checked") ) {
// 처리로직;
// }
});
5) checkbox value 값 가져오기
$('input:checkbox[id="checkbox_id"]').val();
6) checkbox checked 처리하기
$('input:checkbox[id="checkbox_id"]').attr("checked", true);
2. JQuery radio 버튼 컨트롤
1) 선택된 라디오 버튼 값 가져오기
$('input:radio[name="certWay"]').val();
$(':radio[name="radio"]:checked').val();
if($(':radio[name="radio_name"]:checked').length == 0) { alert('설문을 선택하세요'); return; }
1) selelct box 내용 가져오기
$('#select_box > option:selected').val();
2) 값 설정
$('#select_box > option[value=지정값]').attr('selected', 'true');
3) select disabled
$('#select_box').attr('disabled', 'true');
[출처] JQuery 라디오radio 체크박스checkbox|작성자 freesemo
'언어 > js' 카테고리의 다른 글
window.print() 원하는 영역만 프린트 하기 (0) | 2013.01.11 |
---|---|
jquery 이중 셀렉트박스 구현 with php (0) | 2012.11.08 |
글자 수 제한 스크립트(오버된 글씨는 전체 삭제) (0) | 2012.09.04 |
마우스 우클릭/드래그/선택/키입력 금지 (0) | 2012.03.15 |
자바스크립트 특수문자 제한 (0) | 2011.11.23 |