bind-click

2.0.1 • Public • Published

bind-click

Attach a function to the click event while handling some edge cases that I like to address.

Notes

  • Pass in a Node, NodeList, or a string to select the target element
  • Fails gracefully if no elements are selected
  • If a string selector is passed in, the DOM is queried each time giving a "jQuery live"-ish behavior
  • Default event is click
  • Solves click issue on some older iOS touch screens

Basic Usage

bindClick(document.querySelectorAll('.button'),function (e) {
  console.log(e);
});

Requirements

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i bind-click

      Weekly Downloads

      1

      Version

      2.0.1

      License

      ISC

      Unpacked Size

      6.06 kB

      Total Files

      6

      Last publish

      Collaborators

      • ryanburnette