I’m building a comment system where you just start typing and a div fades in to fill your screen with a text area and a submit box.
However, I’m having a few problems that I was hoping the community could help me solve.
-
Here’s my code for the fadeIn event. For some reason instead of accepting all keys between A-Z, It accepts any key. I would suspect that this (65<=e.keyCode<=90) is not the right format for this, but I don’t know how to format it.
$( document ).on( 'keydown', function ( e ) { if ( 65<=e.keyCode<=90) { $( elem ).fadeIn(); } }); -
Also when the div opens I want the key they pressed to open the div to be posted in the text area. This way you could literally just start typing and everything would appear as you had intended. I figure the best way to do this is to store the key press and update the value attribute of the textarea. After that the textarea would have to become active so they don’t have to click on it to type the rest.
Help with both these issues would be greatly appreciated.
Replace
with
You were computing
which is always
trueas, in order to be compared,falseis converted to0andtrueto1(and both are smaller than 90).