PLEASE FORGET THIS QUESTION
I forgot that this page is in the transition from prototype.js to jQuery, and $() refers to prototype.js and jQuery() refers to jQuery
There are 42 or so answers which say it works. IT DOES NOT FOR ME!! It is not a duplicate answer, something must be different,
"Everywhere" the solution for "Does element exist?" is listed as
if ($("#notexist").length > 0)
if ($("#notexist").length > 0) {alert("exists");} else {alert("Doesn't exist");}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
`
However, if I'm using the debugger in chrome, it throws error TypeError: Cannot read property 'length' of null
if the element doesn't exist?
Has chrome suddenly changed how .length works? Or is it just assumed that the error is ignored?
Must I put it in a try/catch?