html - for attribute in label behave differently in ie -


for attribute perform differently in ie9 , ie10. when clicking on label checked-in checkbox in ie in other browser wont. fiddle

//js

  <script type="text/javascript">     function show(){     alert(0);     }     </script> 

//html

<table width="100%" border="0" cellspacing="0" cellpadding="0">   <tr>     <td><input type="checkbox" id="test" /></td>     <td><label for="test"><a href="javascript:show()">click</a></label></td>   </tr> </table> 

from html5 specification:

the label element's exact default presentation , behavior, in particular what activation behavior might be, if anything, should match platform's label behavior. activation behavior of label element events targeted @ interactive content descendants of label element, , descendants of interactive content descendants, must nothing.

for example, on platforms clicking checkbox label checks checkbox, clicking label in following snippet trigger user agent run synthetic click activation steps on input element, if element had been triggered user:

[... snipped code sample ...]

on other platforms, behavior might focus control, or nothing.

the specs seem leave lot of freedom though, basically, on clicking on label, if browser has something, should happens on current platform.

for example, if recall correctly, in windows when click on label (in wdinows form) checkbox receives click well, should happen in browser running in windows.

again, since there lot of freedom, pretty every browser likes.

if question, not clear, how avoid behaviour, may have work around way using jquery or javascript. seems work, after first quick test in ie10:

<label for="test">     <a href="#" onclick="show(); return false;">jitender</a> </label> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -