Kaitlyn Sacco
Kaitlyn Sacco

Reputation: 43

remove() not working in jquery, turn no method

var deleteTarget = $('ul li .active');
deleteTarget.remove();

Not sure what's wrong, the console says it has no method, or shall I still use $(deleteTarget) ?

Upvotes: 0

Views: 62

Answers (3)

Enrique Gil
Enrique Gil

Reputation: 754

Can you try this one ???

$("ul li").remove(".active");

id try mixin up the codes from this site Here

Upvotes: 0

Jan Zyka
Jan Zyka

Reputation: 17888

Your jquery string is almost certainly wrong.

# queries for ID

You probably wanted to do:

var deleteTarget = $('ul li .active');

Upvotes: 0

gdoron
gdoron

Reputation: 150263

$ is obviously not jQuery in your case.

You can check if it is with:

console.log($().jquery); // if undefined, it's not jQuery

Upvotes: 2

Related Questions