views:

298

answers:

1

All right, this one is going to sound very weird and I don't know if any of you have experienced the same problem.

I have a very simple login form (in html) which includes username, password and submit button and works fine on IE but when I run it in Firefox (3.xxx) and click on password textfield, the focus jumps on username and selects the text. What's even more I can easily navigate using the keyboard but not with the mouse click.

Just curious, does anyone else have this problem and perhaps a solution, or is it just me? Thanks for your time and help! Uran

+5  A: 

You probably did something like the following:

<label for="username">
    Username: <input type="text" id="username" name="username" />
</label>
<label for="username">
    Password: <input type="password" id="password" name="password" />
</label>

Notice how the second label is still marked for="username". Make sure the for attribute matches the proper field. Also, when the input tags are nested in label you technically don't need to specify a value for for.


The second option is that you did something like the following:

<label>
    Username: <input type="text" id="username" name="username" /><br />
    Password: <input type="password" id="password" name="password" />
</label>

In this case, the focus is given to the first input. When using input nested inside a label tag, makes sure there is only one inside the said label.

Andrew Moore
wow, amazing--- it was the second case and it did fix it, many thanks Andrew
@Uran: then feel free to mark my answer as accepted. It's that little checkmark below the vote counter.
Andrew Moore