mirror of
https://github.com/Estom/notes.git
synced 2026-04-23 18:11:47 +08:00
前端笔记整理完成
This commit is contained in:
@@ -30,13 +30,21 @@
|
||||
* unload
|
||||
|
||||
## 2 事件处理
|
||||
### 事件处理方法
|
||||
### 直接绑定事件处理方法
|
||||
回调函数作为参数进行传递。
|
||||
|
||||
```
|
||||
("p").click(function(){$(this).hide()});
|
||||
$("p").click(function(){$(this).hide()});
|
||||
```
|
||||
### $(document).ready()
|
||||
|
||||
在加载完成文档后需要执行的函数。
|
||||
|
||||
|
||||
### 通过bind绑定事件处理方法
|
||||
可以直接在jQuery对事件进行绑定。而不用在html代码中书写js代码了。
|
||||
* bind绑定
|
||||
|
||||
```
|
||||
$(selector).bind(eventtype,eventdata,handler(eventobject))
|
||||
```
|
||||
Reference in New Issue
Block a user