var hasErrors = $('#booking').validator('validate').has('.has-error').length;
if (hasErrors) { fail here }
this does not work if you are quick enough and create an invalid field just before invoking validator('validate') which returns immediately with old still valid jQuery content and invalidation happens only after that in a callback.
69 mentions
this does not work if you are quick enough and create an invalid field just before invoking validator('validate') which returns immediately with old still valid jQuery content and invalidation happens only after that in a callback.
(add a
data-remote
if you need more time)