Generic jQuery/JavaScript validation