Workaround iPhone's browser not honoring the <label> element -


Most recently it went on and I thought it would be useful to share.

HTML & lt; Label & gt; element is supported in a strange way by the iPhone (v3) browser, try it:

  & lt; Input type = "checkbox" id = "chkTest" /> & lt; For label = "chkTest" & gt; Click me! & Lt; / Label & gt;  

"Click me!" Labels have no effect, checkbox is not checked.

& lt; Label & gt; The absence of support in touch devices for the elements torn me and I tried to solve this problem using javascript. Surprisingly, when I did the following by looking at a zero javascript like this:

   gt; & Lt; Label = "ChkTest" onclick = "javascript: zero (0);" & Gt; Click me! & Lt; / Labels & gt;   

More information:

  1. Also works with an empty handler: onclick = ""
  2. < Li> Deactivating JavaScript will disable the label again, even if the empty handler is used.

    following the following CSS rules to trigger the expected label behavior on the iPhone after some experiments. It is sufficient to specify:

    label {cursor: pointer}


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -