I seem to be having a strange jQuery issue. On my page I have a number of text fields and select boxes and this code:
$('input').focus(function() { alert($(this).attr("name")); });
(this is a placeholder code to be completed later on). When the page loads, there are no errors. However focusing any of the text inputs does nothing – at all. I also tried selector $(':input') – with the same result.
What am I missing?
Try using a document ready block, to ensure the input you want to bind to is loaded before you try and add the event.