File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
2
<entry type =" method" name =" one" return =" jQuery" >
3
3
<title >.one()</title >
4
- <desc >Attach a handler to an event for the elements. The handler is executed at most once per element.</desc >
4
+ <desc >Attach a handler to an event for the elements. The handler is executed at most once per element per event type .</desc >
5
5
<signature >
6
6
<added >1.1</added >
7
7
<argument name =" events" type =" String" >
@@ -107,6 +107,19 @@ $( "p" ).one( "click", function() {
107
107
alert( $( this ).text() );
108
108
});
109
109
]]> </code >
110
+ </example >
111
+ <example >
112
+ <desc >Event handlers will trigger once per element per event type</desc >
113
+ <code ><![CDATA[
114
+ var n = 0;
115
+ $(".target").one("click mouseenter", function() {
116
+ $(".count").html(++n);
117
+ });
118
+ ]]> </code >
119
+ <html ><![CDATA[
120
+ <div class="count">0</div>
121
+ <div class="target">Hover/click me</div>
122
+ ]]> </html >
110
123
</example >
111
124
<category slug =" events/event-handler-attachment" />
112
125
<category slug =" version/1.1" />
You can’t perform that action at this time.
0 commit comments