0
我們在表格標題頂部有一個天數列表,如果所選日期大於當天(例如今天是30日,但選擇31日),我們希望禁用全部檢查功能。我們將允許checkAll在小於當前日期的任何日期工作。我們如何實現這一目標?如何防止未來日期的checkAll選擇?
<script type="text/javascript">
jQuery(document).ready(function(){
// This provides selectAll, clearAll capability
jQuery('#records').find('thead th').click(function(){
var ch = jQuery(this).find("input[type='checkbox']").attr('checked');
var col = jQuery(this).prevAll().length;
var ch = jQuery(this).find("input[type='checkbox']").attr('checked');
jQuery('#records').find('tbody td').each(function(){
var tdId = jQuery(this).attr('id');
if(col == tdId) {
if(jQuery(this).hasClass('user-present')) {
// Toggle the value of attribute checked for the checkbox
jQuery(this).find("input[type='checkbox']").attr('checked', true);
}
}
});
});
});
</script>