Do not use the onclick attribute. What your code does is attach a new onclick handler after the user clicks. Perhaps this is not what you want.
You should also use prop instead of attr to change disabled .
Since the element you want to attach to the event may not exist on the finished document, attach it to the nearest ancestor, which will undoubtedly be there.
$( function() { // wait for document ready $( '#parent-div' ).on( 'click', ':checkbox', function( e ) { // attach click event $( '#appTimes' ).find(':text').prop( 'disabled', $(e.currentTarget).is(':checked') ); // set disabled prop equal to checked property of checkbox } ); } );
error source share