Attributes

4 minutes
Share the link to this page
Copied
  Completed
An optional object of data passed to an event method when the current executing handler is bound.

Transcript

Hello, in this jQuery video, I am going to cover event attributes. So you may have already noticed that we got this little function or this little parameter as passed into this inline method method that is binded or bound to this, you know, whatever selected in this case, any paragraph tag, this event actually have quite a lot of attributes that you can check. So what I'm going to do is print that event and see what we get. Or reload, click bind obviously does not. Unless we need names, let's look at a tree view. And I'm going to rename the vent attributes or the idea should say, and I will put Okay, we don't need that because it's when we click the pirate, what am I doing?

Okay, so now If I go back reload, if I click that, we get, you know, a bit of functionality, or I mean a bit of information. And this will tell us, you know, a lot of stuff and obviously, we can print out all of this individually by just doing like dot one of these, I'm going to cover some of them in a second some of the really important one, but I definitely didn't like so much information here. So we got to this page x and y. This shows the different to show the offset, it shows the key code as well, if it was a key on the keyboard, you know, issue, it shows you so much information, the type as well the timestamp, like so much ridiculous information that you get. What I'm going to do is print out some of the obvious ones a dot page x.

One, two, I'm going to put a coat on Why nine, four, reload it and I'll click it on expected and then click that Aleksey deep. Sorry, if I keep clicking it isn't my message in the same position now we have 4725 47 pixels across 25 or I didn't move slightly for movie ran over here but keep my vertical the same roughly, we get a higher first number, the second number is almost the same and the formula down here or back here, we get a lower number but again, the for the ones that are the same, let's move it up a bit to still be able to click it. Now we get a higher or a lower, I should say, second number so we can get exactly where that event occurred if it's a nice event, for example, on the actual screen itself, so I fantastic not just been up to detect a particular type of events and in this case is the click event on a cover all the different other type of events as well in separate videos.

So this part is more points significant, we can get event attributes, you can get so much more, you can get the target, you can get the event type, you can get like what sort of buttons so, just open one of these, like I said, all of the information you can get, you can get the offset as well. You can get you know, there's so much information see, you can see the base URL, you can see you know, any child elements and a lot of information guide. The next task we're going to do is peruse some of these attributes, I'm sure you won't go through all of them. It's not just not feasible, but check out some of them, print them out. And you'll see what you know, wonderful information that jQuery provides you for the elements that it has, you know, you know, provided in the event attribute.

That's it. If you have any questions, feel free to drop me a message. And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.