JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 54
  • Score
    100M100P100Q74792F
  • License MIT

Trigger Button Click on Enter of Input Box

Package Exports

  • be-committed/be-committed.js

Readme

be-committed

be-committed encapsulates and makes declarative a snippet of code that is likely found frequently in various web sites. In particular, trigger a button click on keyboard "enter."

Playwright Tests

How big is this package in your project?

Syntax

<label for=url>Enter Url</label>
<input id=url be-committed='{"to": "change"}'>
<button id=change>Search</button>

<script type=module crossorigin>
    import 'https://esm.run/be-committed';
</script>

Referencing the module, as shown above, only affects input elements outside any ShadowDOM realm.

To affect elements within a ShadowDOM realm, add an instance the tag "be-hive" within the ShadowDOM realm.

What this does:

If you set focus on the input element, start typing, and click enter, it clicks on the "Search" button.

CDN

<script type=module>
    import 'https://esm.run/be-committed'
</script>

Running locally

  1. Do a git clone or a git fork of repository https://github.com/bahrus/be-committed
  2. Install node.js
  3. Run "npm install" from location of folder created in step 1.
  4. Run npm run serve. Open browser to http://localhost:3030/demo/

Using from ESM Module:

import 'be-committed/be-committed.js';

Using from CDN:

<script type=module crossorigin=anonymous>
    import 'https://esm.run/be-committed';
</script>