You call $('.darkYellow').click() before the notes are visible. .click() will add an event to each element that matches the selector during the call. You want something like .live() that will handle all elements present and future, for example.
$('.darkYellow').live('click', function() { $(this).focus(function() { $(this).addClass("index"); }); });
UPDATE
Try:
$('.darkYellow').live('click', function() { $(this).addClass("index"); }); $('.darkYellow').live('blur', function() { $(this).removeClass("index"); });
As someone else remarked, calling the .focus () function is not needed.
Bobby jack
source share