Posted by Benjamin Niemann on 12/21/13 11:41
Stefan Mueller wrote:
>> What do you really want?
>>
>> Should the checkbox be toggled by clicking on the image?
>> This can be done by wrapping the IMG and the INPUT in a LABEL element:
>
>
> Yes, the checkbox should be toggled by clicking on the image. I need that
> to color the checkbox. Please see the example on
> http://nrkn.com/customCheck/
>
> Therefore I'd like to reach the image also by pressing the Tab key.
> With your code <label>...</label> the image never gets the focus even not
> with Internet Explorer and Mozilla.
IMG are not supposed to be interactive elements that can get focus (except
for an IMG inside of a BUTTON perhaps). That's why the browser will not
give it focus via tab, no matter how much you try.
If I would not think that your approach (emulating existing elements for the
sake of some pretty colors) is at least a bad idea, I could suggest that
you try using an INPUT with an image as SRC that can get focus...
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
[Back to original message]
|