Handle click and double-click for the paragraph. Note: the coordinates are window relative, so in this case relative to the demo iframe.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
|
Демонстрация:
To display each paragraph's text in an alert box whenever it is clicked:
1
2
3
|
|
You can pass some extra data before the event handler:
1
2
3
4
5
6
|
|
Cancel a default action and prevent it from bubbling up by returning false
:
1
2
3
|
|
Cancel only the default action by using the .preventDefault() method.
1
2
3
|
|
Stop an event from bubbling without preventing the default action by using the .stopPropagation() method.
1
2
3
|
|
Bind custom events.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
|
Демонстрация:
Bind multiple events simultaneously.
1
2
3
4
5
6
7
8
9
10
11
|
|