In the code below, the first alert() fires, but the second one never fires when I click the textfield assigned with the 'clear' class.
Does anyone have a clue why this happens?
(function ($){ alert('TEST 1'); var clearMePrevious = ''; // Clear input on focus. (function ($)('.clear').focus(function() { alert('TEST 2'); /* if ($(this).val() == $(this).attr('title')) { clearMePrevious = $(this).val(); $(this).val(''); } */ }(jQuery)); }(jQuery)); The problem is just in the inner code, as $document.ready() fires the TEST 1 alert.
I have tried different variations of (function ($){}); and function (jQuery){});.