jQuery.validator.format()

jQuery.validator.format( template, argument, argumentN… )

Description: Replaces {n} placeholders with arguments.

One or more arguments can be passed, in addition to the string template itself, to insert into the string.

If you're familiar with the term, this makes this function support currying. If you don't care about that, just use the first argument.

Example:

Sets the debug setting for all validation calls.

1
2
3
var template = jQuery.validator.format("{0} is not a valid value");
// later, results in 'abc is not a valid value'
alert(template("abc"));