Preventing default events


show more Preventing default events provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Events show less
please wait ...

Preventing default events

So far we looked at different mass related events and learn how to add and delete DOM elements. Plus we also learned how to remove event listeners when necessary. I want to show you an example of how can you prevent some of the fault actions when working with events. So I'm going to use an event then handles right clicks called Context Menu. So let's go ahead and go into our code, and just update this paragraph, because we're going to do something a little bit different. So, I'm going to say right click on the image to see a larger version.

And also announce that the preview is going to follow the mouse. So I'll be using another event called mouse move to track the position of the mouse, you can get an idea of how that works. So that's all we need for the HTML and we'll dig into the JavaScript next. So, first thing I need to do is change my event so that instead of detecting a mouse over. It's going to detect something called context menu. So, now, if we go back into our ...

Preventing default events
Video duration: 5m 7s 2h 11m Intermediate

Viewers:

Preventing default events provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Events

Subjects:
Developer Web
Software:
JavaScript
Author:
please wait ...