@channyeintun/selection

0.0.2 • Public • Published

Selection Change Polyfill

Selection change event for html input elements is only supported on firefox.
So, I started writing my own poyfill for unsupported browsers.
Barely functional, probably not useful to you :D

Check its availability on caniuse.

Getting Started

Event Name selection

Example

   <input id="mytext" />
   <p id="log"></p>
   <script src="selection.js"></script>
   <script>
      const selpolyfill = new selection();
      selpolyfill.init();
      const myInput = document.getElementById('mytext');
      myInput.addEventListener('selection', function (e) {
         log.textContent = `You selected ${e.detail.start} to ${e.detail.end}.
          Direction:${e.detail.direction}`
         console.log('detail', e.detail);
      })
   </script>

License

This is MIT Licensed.

/@channyeintun/selection/

    Package Sidebar

    Install

    npm i @channyeintun/selection

    Weekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    4.41 kB

    Total Files

    5

    Last publish

    Collaborators

    • channyeintun