Add an optional errorsContainer instead of appending an errors container to the dom. Cleanup instanceof $ into a helper function called .