P
Paul E Collins
I have a Web form with a number of text boxes. If the user submits the
page with some text boxes filled in, those then become plain text
(with accompanying <input type="hidden"> fields for when the page is
resubmitted) - so the number of text boxes varies.
I was using this to focus on the first text box:
<body onLoad="document.forms[0].elements[0].focus();">
But it doesn't work when the first text box has been removed. In
effect, the browser is setting the focus to the new first control
(with type="hidden") so the caret is not visible.
How can I focus on the first *visible* input element?
P.
page with some text boxes filled in, those then become plain text
(with accompanying <input type="hidden"> fields for when the page is
resubmitted) - so the number of text boxes varies.
I was using this to focus on the first text box:
<body onLoad="document.forms[0].elements[0].focus();">
But it doesn't work when the first text box has been removed. In
effect, the browser is setting the focus to the new first control
(with type="hidden") so the caret is not visible.
How can I focus on the first *visible* input element?
P.