1. It is not possible while typing.
2. There are numerous client side algorithms but it is not recommended as any one can view JavaScript code and hack.
If you are keen to protect data during Client - Server transactions, simply go for HTTPS protocol and it will automatically encrypt data when it is sent from Client to server ot vice versa.