Update tran.js

Removed the bug where the last element was not getting translated correctly.
Modified the code to include all input types.