Archive for December, 2009
-
use name attribute for input instead of id for use with label
you need Jquery:
<label for="myinput"></label><input name="myinput" type="text" value="text here" />
$('label').live('click', function(e){
if( $(e.target).is(':input') ) return;
var i = $(':input[name="' + $(this).attr('for') + '"]')
i.is(':checkbox') ? i.attr('checked', !i.attr('checked') ) : i.focus().select();
})

