I am trying to understand what the ? and the : are doing in this code, I see it a lot in code but I never can understand what exactly it is doing?
Could someone please point me in the right direction, this bit of code is from the jQuery validate() DOCS
$(".selector").validate({
invalidHandler: function(event, validator) {
// 'this' refers to the form
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});