Defensive programming with jQuery