I\'m using jQuery and I want to check the existence of an element in my page. I have written following code, but it\'s not working:
if($(\"#btext\" + i) != n
if ( $('#whatever')[0] ) {...}
The jQuery object which is returned by all native jQuery methods is NOT an array, it is an object with many properties; one of them being a "length" property. You can also check for size() or get(0) or get() - 'get(0)' works the same as accessing the first element, i.e. $(elem)[0]