From the course: JavaScript for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Where you don't use JavaScript

Where you don't use JavaScript - JavaScript Tutorial

From the course: JavaScript for Web Designers

Start my 1-month free trial

Where you don't use JavaScript

- [Narrator] Now let's take a look at what I call JavaScript anti-use cases. That is, situations where you don't necessarily need to use JavaScript, and indeed perhaps you shouldn't. First of all, if CSS can handle it, you probably don't need to use JavaScript, like any time you're working with visual changes involving the hover event, when your mouse cursor goes over something. Or focus events, when keyboard focus gets onto an element on a page. You can act on those events with CSS by itself, you don't JavaScript. Back in the old days, JavaScript was used for things like swapping out an image in reaction to a mouseover or hover event, rolling over menus, tool tips, various things like that. CSS can handle such things pretty well, so we generally don't need JavaScript in those situations. If we want to do various kinds of animation on our pages, CSS transitions and transforms offer a great deal of power without JavaScript,…

Contents