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
$selector.length
& then bind the event. – Santalaceous$('#typo').length
, but that's something I would do after debugging led me to wonder if my selector was wrong. – Criswellconsole.log($('#typo'))
above the line that adds the handler and see what the console says. – Criswell