checked true for iphone, ipad etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var labelClick = function() { | |
var labels = document.getElementsByTagName('label'); | |
console.log(labels); | |
for(var i=0,len=labels.length; i<len; i++){ | |
if(labels[i].getAttribute('for')) { | |
labels[i].addEventListener('click',function(){ | |
var id = this.getAttribute('for'), | |
target = document.getElementById(id); | |
if(['radio','checkbox'].indexOf(target.getAttribute('type')) !== -1){ | |
target.setAttribute('checked',true); | |
} | |
else{ | |
target.focus(); | |
} | |
}); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment