Is there a 'not found' exception for jquery selector?

Viewed 2151

I just spent 'hours' with the following scenario: (all back to the basics)

 $('#typo').bind('click' etc ...

I had a typo in the selector, but jQuery resolves

$('#funny something out there').bind(...

without any warning.

Is it possible to tell jQuery to raise an error when your selector gets nothing?

Something like this:

 $('#typo', alert('Stupid, nothing here! like '+ '#typo))

edit

I spoke against me:

$('#typo', alert('Stupid, nothing here! like '+ '#typo))

is not a solutiuon. I have to know where the error is to extend the selector

4 Answers
Related