It seems your problem is elsewhere. This code works fine for me:
http://jsfiddle.net/8hZWq/
EDIT
If the children are not inputs, as you said, but the divs - the focus () method is not applicable to them, since it only works for input, text field, selection, etc.
You can also use .click () instead of focus () to save the link to the last element with a click. Keep in mind, however, this also depends on the structure of your elements.
For example, if you have several levels of containers in child divs, the #ID * selector will run several times each level of children starting with the C # ID.
If you like to store the link only to the first level of the #ID child elements, you should use the #ID > * selector to link only to direct children.
If you want to keep the link only to the element that was clicked regardless of the level associated with the container, you should use the target click link instead:
var clicked; $('#ID').click(function(event){ clicked = $(event.target); });
source share