It\'s fairly straightforward. I want to set focus to the first enabled and not hidden control on the page.
For a textbox, I have
$(\"input[type=\'t
$(':input:enabled:visible:first').focus();