fixing javascript to properly select textfields