Tuesday, September 20, 2011

Tapping on <label> in Mobile Safari

Tapping on <label> does not auto-focus linked in Mobile Safari but If we add an empty function as clickhandler it works fine.

<input type="checkbox" id="test" name="test">
<label for="test" id="test_label">This is the label</label>
<script>
document.getElementById("test_label").onclick = function () {};
</script>

This is the releated Stackoverflow discussion.

No comments:

Post a Comment