Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn element into jQuery selector?

Tags:

jquery

How to turn the event.currentTarget into jQuery object or something like that so I could then use jQuery's addClass method on the object? I know I could just do like: event.currentTarget.className += ' .class', but I was wondering how to work with the event target with jQuery.

$('.class').click(function(event) {
    Class.down($(this).parent().prev().attr('alt'));
    Class.style($(event.currentTarget));
});
like image 270
Rihards Avatar asked Dec 22 '22 19:12

Rihards


1 Answers

$(event.currentTarget).addClass("classname");
like image 177
jessegavin Avatar answered Jan 09 '23 11:01

jessegavin