Example 1 — Trigger Another Click
Button #2 programmatically fires Button #1’s click handlers.
$("#btn1").on("click", function () {
$("#out").text("Button #1 handler ran");
});
$("#btn2").on("click", function () {
$("#btn1").trigger("click");
$("#out").append(" · Button #2 also ran");
}); How It Works
- Bind. #1 has its own click handler.
- Trigger. #2 calls
$("#btn1").trigger("click"). - Reuse. #1’s handlers run without a physical click on #1.

