is-button

Check if an element is a button

Usage no npm install needed!

<script type="module">
  import isButton from 'https://cdn.skypack.dev/is-button';
</script>

README

is-button

Check if an element is a button (<button> or input[type="button"])

Supported in IE8+.

Install

$ npm install --save is-button

Usage

var isButton = require('is-button');

isButton(document.querySelector('#el')); // <button id="el">Button</button>
//=> true

isButton(document.querySelector('#el')); // <input type="button" id="el">
//=> true

isButton(document.querySelector('#el')); // <strong id="el">Not a button</strong>
//=> false

isButton(document.querySelector('#el')); // <input type="submit" id="el">
//=> false

License

MIT © Arthur Verschaeve