Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if element has been removed JQuery

Tags:

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();
like image 215
manycheese Avatar asked Jan 05 '11 16:01

manycheese


1 Answers

check the length of the selector, like this:

$('#editMapItem h4').length

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

like image 62
nathan gonzalez Avatar answered Oct 14 '22 00:10

nathan gonzalez