Timeline for Is there an "exists" function for jQuery?
Current License: CC BY-SA 3.0
2 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 21, 2015 at 15:16 | comment | added | Salman Arshad |
No, jQuery.first() or jQuery.eq(0) both return objects, objects are truthy even if they are empty-ish. This example should illustrate why these functions cannot be used as-is: if(jQuery("#does-not-exist").eq(0)) alert("#does-not-exist exists")
|
|
Jan 18, 2014 at 9:04 | history | answered | Salman Arshad | CC BY-SA 3.0 |