The following code:
$('.test1').focus(function () {
alert('inside');
});
should instead be bound to #test
first.
$('#test').focus('.test1', function () {
alert('inside');
});
Since you are still using jQuery 1.4.2; you need to use .live()
method for handlers.
The code shall be
$('#test').live('focus', '.test1', function () {