Click here to Skip to main content
15,885,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello team

this is my question:-how can automatically event is trigger when alert-box is show on page in javascript?
how it solve out please help me
Posted

1 solution

You can use trigger function of jQuery.
Code sample is given below:
Html Code:
<input type="text" value="Hello World"><br><br>
<button>Trigger the select event for the input field</button>
</br></br>

Script:
$("input").click(function(){
       $("input").after(" Text marked!");
   });
   $("button").click(function(){
       alert("This is a alert");
       $("input").trigger("click");
   });


For more learning have a look here.
http://www.w3schools.com/jquery/event_trigger.asp[^]
https://learn.jquery.com/events/triggering-event-handlers/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900