※ 이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.
id 인 경우 : $('input [type=checkbox] [ id="checkbox_id" ]')
name인 경우 : $('input [ name="checkbox_name"]')
유니크인 id인 경우 : $(".checkbox_id")
유니크인 name인경우 : $("#checkbox_name")
-----------------------------------------------------------------------------
window.onload = function() {
$(".btnB").on("click", function(e) {
//checkbox true인지 false인지 확인
var value = $('input:checkbox [ name="checkbox_name"]').is(':checked');
if(value){
//checkbox 상태 false로 변경
$('input:checkbox [ name="checkbox_name"]').attr('checked',false);
}
else{
//checkbox 상태 true로 변경
$('input:checkbox [ name="checkbox_name"]').attr('checked',true);
}
});
}
'프로그래밍 언어' 카테고리의 다른 글
[Java script] 페이지 이동 (0) | 2013.07.08 |
---|---|
[JQuery] checkbox false일때 안내문 on, true일때 안내문 off 예제 (0) | 2013.07.06 |
[JQuery] append(), remove(), empty() 예제 (0) | 2013.07.05 |
[Mysql] DB 데이터 삭제 (0) | 2013.06.29 |
[Mysql] LIKE로 두개의 조건 거는 방법 (0) | 2013.06.28 |