arthurvr / is-button

Check if an element is a button

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-button

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

Supported in IE8+.

Install

$ npm install --save is-button

Usage

const 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

About

Check if an element is a button

License:MIT License


Languages

Language:JavaScript 68.9%Language:HTML 31.1%