Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.


Prefix Classes for JavaScript

It's recommended that you do not share the same selector with CSS and JavaScript. For instance, if you're selecting an element with JavaScript, avoid relying on a selector that's also used in your CSS.

If a class is going to be used by JavaScript only, it's common to use a dedicated prefix, like js-. Consider the following button element:

<button class="btn-lg js-modal">C...