Reputation: 46308
I have a JS Function that looks like this:
$(function() {
$(".accordion").on("click", "dd", function (event) {
$("dd.active").find(".content").slideToggle("slow");
$(this).find(".content").slideToggle("slow");
var current = event.currentTarget
if (current.hasClass('active')) {
current.removeClass('active');
}
})
});
The first part works fine, the second part (starting with var current =
) works the first time then jQuery throws an error:
TypeError: current.hasClass is not a function
if (current.hasClass('active')) {
How do I solve this issue?
Here is a jsFiddle.
Upvotes: 1
Views: 51