Encrypting data in the browser via JavaScript is pointless if the HTML & JavaScript is not served via TLS. Without the encryption, and associated authentication procedure, provided by TLS there is no guarantee that the user received the correct JavaScript code or even performed the encryption. A Man-In-The-Middle attack here would simply remove the encryption and redirect all data to their own server, record the data and then encrypt it before passing it on to the website.
You can find a more detailed explanation at:
avastechnology.com/Blog/Post/Man-in
...