2

I'm trying to make a custom checkbox, so I made something like that : http://jsfiddle.net/wQdUn/2/

The problem is that, on WebKit based browsers, the checkbox is toggled only when clicking on the content of the <span>, not on the box itself, while in Firefox I get the behavior I expect.

So I have two questions:

  • Which one is the right behavior (i.e. the one conform to specifications)?
  • How do I get the result I want in both browsers (and others...)?

Thanks.

2 Answers 2

5

Not sure about the first question, but if you make the span an inline block too, it'll work as you expect in WebKit browsers. See http://jsfiddle.net/wQdUn/5

Sign up to request clarification or add additional context in comments.

3 Comments

@thirtydot: The original fiddle here didn't work in Chrome or Safari. I get the feeling WebKit is trolling us sometimes.
The original fiddle works in Safari 5.0.3/Windows 7, but doesn't work in Safari 5.1/Server 2008. I guess I need to update Safari on my actual computer so it can break properly..
0

For those who come to this topic form google:

Safari 6.0.4(8536.29.13) still got this problem, you need to set inline-block on pseudo-element to make click work.

Chrome switched to Blink as it's rendering engine, so this problem didn't happen on chrome any more(26.0.1410.65).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.