Love beautiful code? We do too.
.focusin(): Xử lý một sự kiện "focusin" (xác nhận một focus).
Đã được thêm vào từ phiên bản 1.4
.focusin(function(){...});
$('p').focusin(function(){
$(this)find('span').css('display','inline');
});
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>
<style>
input { color: #ccc; }
</style>
<script>
$(function(){
$('p').focusin(function(){
$(this).find('input').css('color','#000');
});
});
</script>
</head>
<body>
<p><input type="text" value="Nhập text" />
<p><input type="text" value="Nhập text" />
</body>
</html>
Hiển thị trình duyệt:
Click vào trường input để thấy kết quả.
Hoclaptrinh.vn © 2017
From Coder With
Unpublished comment
Viết câu trả lời