开发者

How to turn element into jQuery selector?

开发者 https://www.devze.com 2023-02-05 22:20 出处:网络
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 +=

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.curr开发者_C百科entTarget));
});


$(event.currentTarget).addClass("classname");
0

精彩评论

暂无评论...
验证码 换一张
取 消