/** * Attendance Manager JavaScript Functions */ jQuery( document ).ready( function( $ ) { $( 'form[id$="_scheduler"] input[name^="attmgr_off"]' ).on( 'click', function() { var name = $( this ).attr( 'name' ).replace( /off/g, 'post' ); var target = 'select[name^="' + name + '"]'; if ( $( this ).prop( 'checked' ) ) { $( target ).attr( 'disabled', 'disabled' ); } else { $( target ).removeAttr( 'disabled' ); } }) var list = new Array(); $( 'form[id$="_scheduler"] select[name$="starttime]"]' ).eq(0).children().each( function() { list.push( { value: $( this ).val(), text: $( this ).text() } ); }); $( 'form[id$="_scheduler"] select[name$="endtime]"]' ).each( function() { var name = $( this ).attr( 'name' ); var endtime = 'select[name="' + name + '"]'; var starttime = endtime.replace( /endtime/g, 'starttime' ); var selected = $( endtime + ' option:selected' ).val(); if ( $( starttime ).val() != '' ) { $( endtime ).children().remove(); $.each( list, function( key, obj ) { if( obj['value'] > $( starttime ).val() ) { $( endtime ).append( $( '