DEV Community

Cover image for jQuery trigger()
Luca
Luca

Posted on

1

jQuery trigger()

Hi dev!🙋‍♂️

During my work i used an event looks very interessant: is a trigger() event.

The trigger() method triggers the specified event more times:
🧑‍💻

<button type="button" class="click"> CLICK </button>

<div class="container">
</div>
Enter fullscreen mode Exit fullscreen mode
$('.button').click(function(){
    $(document).trigger('nameOfMyTriggerEvent')
})

$(document).on('nameOfMyTriggerEvent', function(){
    $('.container').hide();
})

Enter fullscreen mode Exit fullscreen mode

It's easy and very usefull if you need to trigger an event more times.

Hope it helpfully!
✌️

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more