Update scripts.js

now this will swap on inputs with the type of text as well.

the other updates allow jshint validation.