제이쿼리 jQuery ( ": checkbox")
jQuery ( ": checkbox")
$( ":checkbox" )는에 해당합니다 $( "[type=checkbox]" ). 다른 의사 클래스 선택기 ( ":"로 시작하는 선택기)와 마찬가지로 태그 이름이나 다른 선택자를 앞에 두는 것이 좋습니다. 그렇지 않으면 범용 선택기 ( "*")가 내포됩니다. 다른 말로 표현하면 맨손은와 $(':checkbox')동일 $( "*:checkbox" )하므로 $( "input:checkbox" )대신 사용해야합니다.
추가 참고 사항 :
:checkboxCSS 사양의 일부가 아닌 jQuery 확장 이기 때문에 사용하는 쿼리 :checkbox는 기본 DOM querySelectorAll()메서드 에서 제공하는 성능 향상을 이용할 수 없습니다 . 최신 브라우저의 성능을 높이려면 [type="checkbox"]대신 사용하십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>checkbox demo</title>
<style>
textarea {
height: 25px;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<form>
<input type="button" value="Input Button">
<input type="checkbox">
<input type="checkbox">
<input type="file">
<input type="hidden">
<input type="image">
<input type="password">
<input type="radio">
<input type="reset">
<input type="submit">
<input type="text">
<select>
<option>Option</option>
</select>
<textarea></textarea>
<button>Button</button>
</form>
<div></div>
<script>
var input = $( "form input:checkbox" )
.wrap( "<span></span>" )
.parent()
.css({
background: "yellow",
border: "3px red solid"
});
$( "div" )
.text( "For this type jQuery found " + input.length + "." )
.css( "color", "red" );
// Prevent the form from submitting
$( "form" ).submit(function( event ) {
event.preventDefault();
});
</script>
</body>
</html>
$( ":checkbox" )는에 해당합니다 $( "[type=checkbox]" ). 다른 의사 클래스 선택기 ( ":"로 시작하는 선택기)와 마찬가지로 태그 이름이나 다른 선택자를 앞에 두는 것이 좋습니다. 그렇지 않으면 범용 선택기 ( "*")가 내포됩니다. 다른 말로 표현하면 맨손은와 $(':checkbox')동일 $( "*:checkbox" )하므로 $( "input:checkbox" )대신 사용해야합니다.
추가 참고 사항 :
:checkboxCSS 사양의 일부가 아닌 jQuery 확장 이기 때문에 사용하는 쿼리 :checkbox는 기본 DOM querySelectorAll()메서드 에서 제공하는 성능 향상을 이용할 수 없습니다 . 최신 브라우저의 성능을 높이려면 [type="checkbox"]대신 사용하십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>checkbox demo</title>
<style>
textarea {
height: 25px;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<form>
<input type="button" value="Input Button">
<input type="checkbox">
<input type="checkbox">
<input type="file">
<input type="hidden">
<input type="image">
<input type="password">
<input type="radio">
<input type="reset">
<input type="submit">
<input type="text">
<select>
<option>Option</option>
</select>
<textarea></textarea>
<button>Button</button>
</form>
<div></div>
<script>
var input = $( "form input:checkbox" )
.wrap( "<span></span>" )
.parent()
.css({
background: "yellow",
border: "3px red solid"
});
$( "div" )
.text( "For this type jQuery found " + input.length + "." )
.css( "color", "red" );
// Prevent the form from submitting
$( "form" ).submit(function( event ) {
event.preventDefault();
});
</script>
</body>
</html>
게시판 목록
개발자팁
개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5396 | 기타 |
슈퍼스타맨
|
4개월 전 | 350 | |
| 5395 | PHP |
untitled
|
5개월 전 | 822 | |
| 5394 | MySQL |
선택과집중
|
6개월 전 | 594 | |
| 5393 | 웹서버 |
techstar
|
8개월 전 | 861 | |
| 5392 |
|
1년 전 | 1217 | ||
| 5391 | 10개월 전 | 1117 | |||
| 5390 | 10개월 전 | 904 | |||
| 5389 | 9개월 전 | 874 | |||
| 5388 | 9개월 전 | 974 | |||
| 5387 | 8개월 전 | 807 | |||
| 5386 | JavaScript |
nekoieye
|
8개월 전 | 971 | |
| 5385 | 웹서버 | 8개월 전 | 989 | ||
| 5384 | JavaScript |
|
9개월 전 | 817 | |
| 5383 | 기타 | 10개월 전 | 1127 | ||
| 5382 | 기타 |
|
10개월 전 | 576 | |
| 5381 | JavaScript | 10개월 전 | 905 | ||
| 5380 | 기타 |
|
10개월 전 | 690 | |
| 5379 | JavaScript | 10개월 전 | 690 | ||
| 5378 | 10개월 전 | 1198 | |||
| 5377 | 기타 |
|
11개월 전 | 760 | |
| 5376 | jQuery |
|
11개월 전 | 574 | |
| 5375 | jQuery |
techstar
|
11개월 전 | 728 | |
| 5374 | 기타 |
|
11개월 전 | 778 | |
| 5373 | MySQL |
|
11개월 전 | 808 | |
| 5372 | 기타 |
|
11개월 전 | 1013 | |
| 5371 | JavaScript |
|
11개월 전 | 727 | |
| 5370 | JavaScript |
|
11개월 전 | 731 | |
| 5369 | PHP |
|
11개월 전 | 1243 | |
| 5368 | PHP | 1년 전 | 1408 | ||
| 5367 | 기타 |
nekoieye
|
1년 전 | 1283 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기