Hi all,

For focusing first input text field, the usual solution is $
(':text:visible:enabled:eq(0)').focus(). However, when these fields
are in an ':hidden' parent (not 'visible' by our eyes), it won't work.

Currently I tried to solve this by:

$(":text:visible:enabled").filter(function(){
        return $(this).parents(":hidden").size()==0;
}).slice(0,1).focus();

I have setup a test page for this: http://www.seezone.net/dev/focusField.html
Try to toggle different parent to and click 'focus'. It should work
correctly.

I would like to know if there is any other 'selector-based' way to do
so?

Reply via email to