manycheese
manycheese

Reputation: 3685

Check if element has been removed JQuery

I have script that removes an h4 element then animates a hidden form in its place. I am trying to check if the h4 element has been removed so that if the same button is pressed ,while the form is visible, it will then animate out.

Here is the first part of my code

$('#editMapItem h4').remove();

Upvotes: 6

Views: 7439

Answers (1)

nathan gonzalez
nathan gonzalez

Reputation: 12017

check the length of the selector, like this:

$('#editMapItem h4').length

if it = 0, you've removed it already.

Upvotes: 7

Related Questions