• passepartout@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        9 days ago

        Yes, but element selectors based on the tag name alone are considered bad practise. Especially in bigger HTML sites. Even more so if you use a JS library / framework or some broad browser stylesheet underneath, or you use the same stylesheet in several places.

        Also, a div or img tag can be a button with its own event listener as well. That may be asking for trouble as well, but I’ve been there (not proud of it).