Update application.js

Fix global variable "valid"