/ notes
A collection of thoughts, things I've learnt and things I want to remember

Huffduffer input copying

Huffduffer has a nice little feature that helps a user copy some content. It puts the content in a input element and selects the whole lot when the user clicks on it.

It is an enhancement, done with JS.

An event listener waits for a click, checks if the input has a readonly attribute and then selects the whole contents of the input. E.g.

this.$module.addEventListener('click', function (ev) {
    var target =
    if (target.hasAttribute('readonly')) {
frontend / js