Additional else if statement to disable keyboard at max

Cannot get 'else if' statement to work properly. Disabling keydown
function works only when the first 'if' statement is disabled.