從哪裡找到所有 jQuery 事件的列表?
事件是您的 Web 應用程式可以檢測到的操作。當觸發這些事件時,您可以使用自定義函式對事件執行幾乎任何操作。這些自定義函式呼叫事件處理程式。
示例
我們來看一個 bind() jQuery 事件的示例。使用 jQuery 事件模型,我們可以使用 bind() 方法在 DOM 元素上設定事件處理程式,如下所示
<html>
<head>
<title>jQuery bind()</title>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('div').bind('click', function( event ){
alert('Hi there!');
});
});
</script>
<style>
.div {
margin:10px;
padding:12px;
border:2px solid #666;
width:60px;
}
</style>
</head>
<body>
<p>Click on any square below to see the result:</p>
<div class = "div" style = "background-color:blue;">ONE</div>
<div class = "div" style = "background-color:green;">TWO</div>
<div class = "div" style = "background-color:red;">THREE</div>
</body>
</html>這裡列出了一些 jQuery 事件
| 序號 | 事件型別和說明 |
|---|---|
| 1. | 失去焦點 當元素失去焦點時發生。 |
| 2. | 更改 當元素髮生更改時發生。 |
| 3. | 單擊 當滑鼠單擊時發生。 |
| 4. | 雙擊 當滑鼠雙擊時發生。 |
| 5. | 鍵盤按下 當按下鍵時發生。 |
| 6. | 滾動 當視窗滾動時發生。 |
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP