You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elisabeth Hamel edited this page Jan 18, 2017
·
20 revisions
The examples are written in jQuery but the guidelines are also valid in VanillaJS.
Selectors
Use IDs to select elements used in JS. This is better for performance and as we are not using IDs in CSS, it allows us to see directly in the HTML which elements are used in JS.
If you must use a class, add a specific class not used in CSS with the "js-" prefix.