Adding javascript to let user click table cell to check containing checkbox.

This is a usability improvement as it widens the target of the click. The script for moremember.pl includes code necessary to uncheck its sibling as per uncheck_sibling(). If this patch is approved I will look for other instances so that <td> interactions will be consistent.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Owen Leonard 2008-11-06 13:04:11 -06:00 committed by Chris Cormack
parent 0273dbf80f
commit 9a272bd79f
2 changed files with 19 additions and 0 deletions

View File

@ -41,6 +41,13 @@ $.tablesorter.addParser({
}
} ).attr( 'checked', false );
<!-- /TMPL_IF -->
$("td").click(function(e){
if(e.target.tagName.toLowerCase() == 'td'){
$(this).find("input:checkbox").each( function() {
$(this).attr('checked', !$(this).attr('checked'));
});
}
});
});
//]]>
</script>

View File

@ -51,6 +51,18 @@ $(document).ready(function() {
}
} ).attr( 'checked', false );
<!-- /TMPL_IF -->
$("td").click(function(e){
if(e.target.tagName.toLowerCase() == 'td'){
$(this).find("input:checkbox").each( function() {
$(this).attr('checked', !$(this).attr('checked'));
if($(this).attr('checked')){
$(this).parent().siblings().find("input:checkbox").each(function(){
if($(this).attr('checked')){ $(this).attr('checked',''); }
});
}
});
}
});
});
function uncheck_sibling(me){
nodename=me.getAttribute("name");