jquery one() method
Translation results:
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() methodsyntax
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:
Parameters | Description |
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() methodexample
<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>
Click the "Run instance" button to view the online instance
Popular Recommendations
- The Magic of `static` in Java: One for All, and All for One!
- One Fruit Simulator codes for September 2024
- Open API specs with more than one YAML file
- Rexas Finance: One of the Leaders in RWA Tokenization
- Integrating Stripe Into A One-Product Django Python Shop
- Angular vs. React: Which One Should You Choose in 4?