Fixed: How can I detect if a selector returns null? #computers #programming #answer
Fixed: How can I detect if a selector returns null? #computers #programming #answer
How can I detect if a selector returns null?
What is the best way to detect if a jQuery-selector returns an empty object. If you do:
alert($('#notAnElement'));
you get [object Object], so the way I do it now is:
alert($('#notAnElement').get(0));
which will write “undefined”, and so you can do a check for that. But it seems very bad. What other way is there?
Answer [by duckyflip]: How can I…
View On WordPress
















