Skip to content

Instantly share code, notes, and snippets.

Avatar

Noah Mason theenoahmason

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am theenoahmason on github.
  • I am noahmason (https://keybase.io/noahmason) on keybase.
  • I have a public key ASBnF0LkWuJhsze34ElmalmN49eGjJm1iVZn5pcMLzYcVwo

To claim this, I am signing this object:

@theenoahmason
theenoahmason / utils.js
Created Jan 10, 2019
Cross Browser Copy To Clipboard function
View utils.js
// Must be called directly in a "short interaction event handler"
// like `click` or `mousedown`/`touchstart`. Cannot be triggered from
// an <a> anchor element, even if `e.preventDefault()` is called on the
// event. passed `input` must be an <input> of any type or a <textarea>.
export function copyToClipboard(input = null) {
if (! input || (['INPUT', 'TEXTAREA'].indexOf(input.tagName) === -1)) {
throw new Error('A Valid <input> or <textarea> HTML element must be passed as the first parameter.');
}
View coming-soon.html
<!-- Coming Soon -->