Handle click event once in jQuery
Description
The following code shows how to handle click event once.
Example
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!-- w w w. ja v a 2 s. c o m-->
$("div").one("click", function(){
alert("clicked.");
});
});
</script>
</head>
<body>
<div>java2s.com</div>
</body>
</html>
The code above generates the following result.
...
Bind future target element with event handl...
Bind mouse enter/leave event to handler in ...
Bind the click event with event handler in ...
Bind the same action twice in jQuery
Block user from typing into the text box in...
Cancel future event in jQuery
Cancel jQuery event in jQuery
Change style for mouse over event in jQuery
Change the font weight and color of all Ita...
Convert key code to char in keypress event ...
Execute an event only once in jQuery
Fire focus event and add style to the nearb...
Get event in page in jQuery
Get event target and work on it in jQuery
Get the event location in jQuery
Get the keycode from event from keydown eve...
Handle a click event and displays the tag n...
Handle anchor click event in jQuery
Handle form select change event in jQuery
Handle input text element key type event in...
Handle the first time click event on div ta...
Handler div element mouse hover event in jQ...
Hover to fade in and out in jQuery
Hover to hide tag in jQuery
Listen to keydown event in jQuery
Listen to keyup event for input element in ...
Listen to load event in jQuery
Listen to mouse down event in jQuery
Listen to mouse enter event in jQuery
Listen to mouse leave event in jQuery
Listen to mouse out event in jQuery
Listen to mouse over event in jQuery
Listen to mouse up event in jQuery
Listen to scroll event in jQuery
Listen to the escape key in jQuery
Listen to the unload event in jQuery
...
Bind future target element with event handl...
Bind mouse enter/leave event to handler in ...
Bind the click event with event handler in ...
Bind the same action twice in jQuery
Block user from typing into the text box in...
Cancel future event in jQuery
Cancel jQuery event in jQuery
Change style for mouse over event in jQuery
Change the font weight and color of all Ita...
Convert key code to char in keypress event ...
Execute an event only once in jQuery
Fire focus event and add style to the nearb...
Get event in page in jQuery
Get event target and work on it in jQuery
Get the event location in jQuery
Get the keycode from event from keydown eve...
Handle a click event and displays the tag n...
Handle anchor click event in jQuery
Handle click event once in jQuery
Handle click event to links in unordered li...Handle form select change event in jQuery
Handle input text element key type event in...
Handle the first time click event on div ta...
Handler div element mouse hover event in jQ...
Hover to fade in and out in jQuery
Hover to hide tag in jQuery
Listen to keydown event in jQuery
Listen to keyup event for input element in ...
Listen to load event in jQuery
Listen to mouse down event in jQuery
Listen to mouse enter event in jQuery
Listen to mouse leave event in jQuery
Listen to mouse out event in jQuery
Listen to mouse over event in jQuery
Listen to mouse up event in jQuery
Listen to scroll event in jQuery
Listen to the escape key in jQuery
Listen to the unload event in jQuery
...