Love beautiful code? We do too.
.andSelf(): Thêm hành động cho chính thành phần chọn ban đầu.
Đã được thêm vào từ phiên bản 1.0
.andSelf()
------------------------------------------------------------------------------
$('div').andSelf().css('border','1px solid blue');
$('div').find(p).andSelf().css('border','1px solid blue');
Html viết:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Tiêu đề</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
$('div').andSelf().css('border','1px solid blue');
});
</script>
</head>
<body>
<div>Thành phần div</div>
</body>
</html>
Hiển thị trình duyệt:
Thực hiện một hành động bởi chính nó, thẻ div được thêm style là border:1px solid blue.
Hoclaptrinh.vn © 2017
From Coder With
Unpublished comment
Viết câu trả lời