I have an html page where I cannot put a DOCTYPE (I am not allowed to). Plus, I need to make it work on IE 8!
Then there is a checkbox + label thing.
For example, this:
<input id="daffodils" type="checkbox" title="daffodil factsheet" name="daffodils" value="checkbox" tabindex=2>
<label for="daffodils">Daffodils</label>
<input id="tulips" type="checkbox" title="tulip factsheet" name="tulips" value="checkbox" tabindex=3>
<label for="tulips">Tulips</label>
My problem:
I want to get the checkbox highlighted when I Tab around, but with this code, only the Labels get highlighted. I tried using TabIndex. but it didn’t help.
Of course, the checkbox can be checked/unchecked, but I wanted the checkbox to be highlighted. (By highlighted – I mean ..the dotted square around an object)
Thanks.
This is not pretty, but it might work for you:
Notice the
onfocusandonblurevents on the input boxes.Edit:
If you’re open to using the jQuery library, you can easily get away from the
onfocusandonblurevents inside the input tags by just adding and removing thefocusclass:I’m sure someone could write the JS code to do the same, but I prefer jQuery.