Jquery – How to grab the width and height for a currentTarget in jquery

eventsheightjqueryresizewidth

I'm trying to get the width and height of target when I click on it. event.currentTarget.width or event.currentTarget.width() (same for height) is not working. Any ideas on how to obtain the current targets width and height?

Best Solution

If you want to use the jQuery methods you need to wrap the elements, e.g.:

$(event.currentTarget).width()

Otherwise you're stuck with using whatever DOM properties your browser supports, e.g..

event.currentTarget.offsetWidth