1. one () method FunctionIs to bind a processing function that only triggers once for the selected element. The syntax format of the called function is one (type, [data], fn)
The parameter type is the event type, that is, the type of event to be triggered. The parameter data is an optional parameter, which indicates that it is used as an event. the data property value is an additional data object passed to the event object. fn is the function to be triggered when an event is bound.
2. Sample Code:
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> Other events </title>
<Script type = "text/javascript" src = "jquery-1.8.3.min.js"> </script>
<Script type = "text/javascript">
$ (Function (){
$ ("# Button"). bind ("click", function (){
$ ("# Button"). attr ("value", "14797710665 ");
});
})
</Script>
</Head>
<Body>
<Div>
<Input id = "button" type = "button" value = "view contact information" class = "btn"/>
</Div>
</Body>
</Html>
3. Preview:
After clicking:
Click "no response ".