jquery trigger() method
Translation results:
trigger
UK[ˈtrɪgə(r)] US[ˈtrɪɡɚ]
n. (gun) trigger; starting device, trigger; triggering other events One thing; [Electronics] trigger, trigger electrical appliance
vt. trigger, trigger; pull the trigger of...; launch or cause explosion (weapons or explosive ammunition)
jquery trigger() methodsyntax
Function: trigger() method triggers the specified event type of the selected element.
Trigger event: Specifies the event to be triggered by the selected element.
Syntax: $(selector).trigger(event,[param1,param2,...])
Parameters:
Parameters | Description |
event | Required. Specifies the event to be triggered by the specified element. It is possible to make custom events (attached using the bind() function), or any standard events. |
[param1,param2,...] | Optional. Additional parameters passed to the event handler. The extra parameters are especially useful for custom events. |
Use the Event object to trigger events: Specify the event to be triggered by the selected element using the event object.
Syntax: $(selector).trigger(eventObj)
Parameters:
Parameter | Description |
eventObj | Required. Specifies a function to run when an event occurs. |
jquery trigger() 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(){ $("input").select(function(){ $("input").after("文本被选中!"); }); $("button").click(function(){ $("input").trigger("select"); }); }); </script> </head> <body> <input type="text" name="FirstName" value="Hello World" /> <br /> <button>激活 input 域的 select 事件</button> </body> </html>
Click the "Run instance" button to view the online instance
Popular Recommendations
- Bitcoin Price Plunges Pushed Down by This Trigger
- Shiba Inu (SHIB) Burn Rate Surges 404% to Trigger Trend Reversal
- Dogecoin (DOGE) Whales Trigger Bullish Momentum, Eye Mpeppe (MPEPE) for 200% Uplift
- CFX Price Prediction: Can Small Risks Trigger a Massive Move in the Conflux Token?
- Aptos Expands, ICP Gains 20%: Could BlockDAG's Soccer Deals with BVB & Inter Milan Trigger Massive Buying
- Altcoins See Considerable Growth This Week, But Can They Sustain the Momentum to Trigger an Altcoin Season?