2018년 12월 6일 목요일
JavaScript - checkbox
[체크박스 전체 선택/해제]
<table>
<colgroup>
<col width="50" />
</colgroup>
<tr>
<th><input type="checkbox" class="ckall" onclick="ckall(this)" /></th>
<th>제목</th>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td>무한도전</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td>세바퀴</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td>1박2일</td>
</tr>
</table>
function ckall(o){
var ck = $(o).prop("checked"); // 선택한 체크박스의 상태가 checked 이면 true 아니면 false를 반환합니다.
if(ck){ // true 이면
$("table input").prop("checked", true); //table 안에 포함된 input 상태값을 체크한다.
}else{ // false 이면
$("table input").prop("checked", false); //table 안에 포함된 input 상태값을 체크해제한다.
}
}
function ckall(o){
var ck = $(o).prop("checked"); // 선택한 체크박스의 상태가 checked 이면 true 아니면 false를 반환합니다.
$("table input").prop("checked", ck); //table 안에 포함된 input 상태값을 체크
}
피드 구독하기:
댓글 (Atom)
MSSQL - Cursor vs Temp Table
#테이블 변수사용의 예 use pubs go declare @tmptable table ( nid int identity(1,1) not null, title varchar (80) not null ) -- 테이블 변수 선언 inse...
-
11 SQL Client for Productive Database Administration & Development Working as a web developer or database administrator, often n...
-
[JSON Serialization] JSON Serialization The JSON Serialization feature converts objects to and from JSON format. This can be use...
댓글 없음:
댓글 쓰기