one

UK[wʌn] US[wʌn]

num.one; (number) one; (base) one, first

n. A person; one body; one o'clock; only

pron. A person; anyone; oneself, others; things

adj. a certain one; one body; one party

jquery one() method syntax

Function: The one() method attaches one or more event handlers to the selected element and specifies the function to be run when the event occurs. When using the one() method, the event handler function can only be run once per element.

Syntax: $(selector).one(event,data,function)

Parameters:

ParametersDescription
event Required. Specifies one or more events to be added to the element. Multiple events separated by spaces. Must be a valid event.
data Optional. Specifies additional data to be passed to the function.
function Required. Specifies a function to run when an event occurs.

jquery one() method example

<html>
<head>
<script type="text/javascript" src="/http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("p").one("click",function(){
    $(this).animate({fontSize:"+=6px"});
  });
});
</script>
</head>
<body>
<p>这是一个段落。</p>
<p>这是另一个段落。</p>
<p>请点击 p 元素增加其内容的文本大小。每个 p 元素只会触发一次改事件。</p>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance