Why this,
if (typeof($("div#elementoquenãoexiste")) !== "undefined") { console.log("existe"); }
returns "existe"
in logs? Should not return% of%, taking into account that the element that the selector indicates does not exist?
Or, because it is involved in a jQuery function ( undefined
) it will be defined since it has functions / properties attached to it, even if the selector points to an element that does not exist in the DOM. Am I right?
I need a correct notion of what is happening in this case, thank you!