Update script.js

Validate text according to rules