2.0.0 • Published 2 years ago

@teedmaker/outside-click v2.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Outside cick

Logo

A simple package to help identifying a outside click of an element

Examples

Dispatch an alert when user clicks outside of an element with the id click-me:

<!DOCTYPE html>
<html lang="en">
<body>
    <main role="main">
        <textarea
            name="example"
            id="example"
            placeholder="Click on another element on the page"
        ></textarea>
    </main>
    <script defer>
        OutsideClick.create('#example').trigger(() => {
            document.querySelector('#example').style.background = 'red';
        });
    </script>
</body>
</html>