JQuery Beginners Tutorial: One Time Events

Say you want to execute an event only once, like the click event. One way to do it would be to set up a counter variable and check if it has reached one. The other way is to use the one event.

In the following example the function executed by the oneTimer button will only run once because it has the one time event.

<button id="oneTimer">Click Me</button>
<button id="manyTimes">No Click Me</button>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
<script type="text/javascript">
		alert("you won't see this alert again, am using .one()");
		alert("click me again to see this alert");