Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Safari

if (navigator.userAgent.indexOf('Safari') != -1) {
	window.addEventListener('load', function() {
		var lock = false;
		var labels = document.getElementsByTagName('label');
		for (var i = 0; i < labels.length; i++)
			labels[i].addEventListener('click', function() {
				var input = (this.htmlFor ? document.getElementById(this.htmlFor) : this.getElementsByTagName('input')[0]);
				if (input && !lock) {
					input.focus();
					lock = true;
					input.click();
					lock = false;
				}
			});
	});
}

You need to create an account or log in to post comments to this site.