Love beautiful code? We do too.
.mouseup(): Ràng buộc một xử lý tới một sự kiện mouseup (nhả chuột), hoặc kích hoạt sự kiện mouseup lên một thành phần.
Đã được thêm vào từ phiên bản 1.0
.mouseup()
$('input').mouseup();
.mouseup(function(){...})
$('input').mouseup(function(){
alert('Bạn vừa click chuột');
});
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(){
$('img').mouseup(function(){
$(this).css('border','5px solid green');
});
$('button').click(function(){
$('img').mouseup()
});
});
</script>
</head>
<body>
<img src="https://hoclaptrinh.vn/themes/client/img/code-screen.jpg" />
<button>Click</button>
</body>
</html>
Khi click vào button, ta đã kích hoạt được giá trị mouseup vào , giống như vừa click vào
và nhả chuột ra.
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(){
$('img').mouseup(function(){
$(this).css('border','5px solid green');
});
});
</script>
</head>
<body>
<img src="https://hoclaptrinh.vn/themes/client/img/code-screen.jpg" />
</body>
</html>
Hiển thị trình duyệt:
Khi click vào <img />
ta sẽ thấy được kết qủa.
Hoclaptrinh.vn © 2017
From Coder With
Unpublished comment
Viết câu trả lời