jQuery.fn.extend ()
jQuery.fn.extend ()
설명 : 객체의 내용을 jQuery 프로토 타입에 병합하여 새로운 jQuery 인스턴스 메소드를 제공합니다.
이 jQuery.fn.extend()메소드는 jQuery prototype ( $.fn) 객체를 확장 하여 jQuery()함수에 연결될 수있는 새로운 메소드를 제공한다 .
예:
두 개의 메소드를 jQuery prototype ( $.fn) 객체에 추가 한 다음 그 중 하나를 사용하십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.fn.extend demo</title>
<style>
label {
display: block;
margin: .5em;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<label><input type="checkbox" name="foo"> Foo</label>
<label><input type="checkbox" name="bar"> Bar</label>
<script>
jQuery.fn.extend({
check: function() {
return this.each(function() {
this.checked = true;
});
},
uncheck: function() {
return this.each(function() {
this.checked = false;
});
}
});
// Use the newly created .check() method
$( "input[type='checkbox']" ).check();
</script>
</body>
</html>
댓글 2개
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4616 | PHP | 8년 전 | 2514 | ||
| 4615 | PHP | 8년 전 | 1708 | ||
| 4614 | jQuery |
|
8년 전 | 2747 | |
| 4613 | MySQL |
|
8년 전 | 3679 | |
| 4612 | jQuery | 8년 전 | 2669 | ||
| 4611 | JavaScript | 8년 전 | 2324 | ||
| 4610 | PHP | 8년 전 | 1998 | ||
| 4609 | PHP | 8년 전 | 1723 | ||
| 4608 | PHP | 8년 전 | 2234 | ||
| 4607 | PHP | 8년 전 | 2848 | ||
| 4606 | PHP | 8년 전 | 2201 | ||
| 4605 | PHP | 8년 전 | 2109 | ||
| 4604 | node.js |
대동소프트
|
8년 전 | 1684 | |
| 4603 | node.js |
대동소프트
|
8년 전 | 2128 | |
| 4602 | node.js |
대동소프트
|
8년 전 | 1839 | |
| 4601 | PHP | 8년 전 | 2345 | ||
| 4600 | PHP | 8년 전 | 2491 | ||
| 4599 | PHP | 8년 전 | 2331 | ||
| 4598 | PHP | 8년 전 | 2355 | ||
| 4597 | PHP | 8년 전 | 2546 | ||
| 4596 | PHP | 8년 전 | 1913 | ||
| 4595 | PHP | 8년 전 | 2398 | ||
| 4594 | PHP | 8년 전 | 2157 | ||
| 4593 | PHP | 8년 전 | 2220 | ||
| 4592 | PHP | 8년 전 | 2278 | ||
| 4591 | PHP | 8년 전 | 2614 | ||
| 4590 | PHP | 8년 전 | 2212 | ||
| 4589 | node.js |
|
8년 전 | 2008 | |
| 4588 | jQuery |
프로그래머7
|
8년 전 | 1677 | |
| 4587 | jQuery |
프로그래머7
|
8년 전 | 1751 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기