Instance Settings

Customise each targetted input field with the settings below (all are optional):

$(selector).realperson({length: 4});

chars | dot | dots | hashName | includeNumbers | length | regenerate

NameTypeDefaultComments
lengthnumber6 The number of characters to be entered.
includeNumbersbooleanfalse Set to true to include the digits 0 to 9 in the characters used to generate the challenge string. Otherwise only the alphabetic characters are used.

Removed 2.0.0 - use chars instead.
regeneratestring'Click to change' The text to display to inform the user that they may click on the challenge to generate a new value - in case they cannot easily read the original value.
hashNamestring'{n}Hash' The field name to use for the hash value that corresponds to the challenge text. Use '(n}' within the setting to substitute the name of the original input field.
dotstring'*' The character used to generate the dot patterns for the challenge letters.

Since 2.0.0.
dotsstring[][]$.realperson.defaultDots Each entry at the top level supplies the dot patterns for the corresponding position in chars. Each entry is an array of strings providing the line by line break down of the dot pattern. Use $.realperson.defaultDots for the default settings.

dots: ['   *   ', '  * *  ', '  * *  ', ' *   * ',
		' ***** ', '*     *', '*     *'], // A
	['****** ', '*     *', '*     *', '****** ',
		'*     *', '*     *', '****** '], // B
	...

Since 2.0.0.
charsstring$.realperson.alphabetic The list of characters to generate the challenge from. The pattern for each character is taken from the corresponding position in dots. You can use $.realperson.alphabetic or $.realperson.alphanumeric for the standard character sequences.

chars: 'ABCDEF'
chars: $.realperson.alphanumeric

Since 2.0.0.
Functions

destroy | disable | enable | getHash | option (get) | option (set) | setDefaults

SignatureReturnsComments
$.realperson.setDefaults(settings)RealPerson object Update the default instance settings to use with all real person instances.
$(selector).realperson('option', options)jQuery object Update the settings for the real person instance(s) attached to the given input(s).

options (object) the collection of new settings.

$(selector).realperson('option', {length: 8, includeNumbers: false});

Since 1.1.0 - previously you used the 'change' command.
$(selector).realperson('option', name, value)jQuery object Update a particular setting for the real person instance(s) attached to the given input(s).

name (string) the name of the setting to change;
value (any) the new value of that setting.

$(selector).realperson('option', 'length', 8);

Since 1.1.0.
$(selector).realperson('option', name)object or any Retrieve one or all of the current settings for the first real person instance attached to the given input(s).

name (string, optional) the name of the setting to retrieve; omit for all settings.

var settings = $(selector).realperson('option');
var length = $(selector).realperson('option', 'length');

Since 1.1.0.
$(selector).realperson('enable')jQuery object Enable the real person functionality for the given input(s).

Since 1.1.0.
$(selector).realperson('disable')jQuery object Disable the real person functionality for the given input(s).

Since 1.1.0.
$(selector).realperson('getHash')number Retrieve the hash value for the currently displayed text.

Since 2.0.1.
$(selector).realperson('destroy')jQuery object Remove the real person functionality from the given input(s).
Salt

Make your challenge more secure by providing a salt value from the server. This value is combined with the random text to generate the hash value.

Since 2.0.0.

You can supply the salt value by setting $.salt directly before loading the Real Person plugin. The value is deleted after being saved by the plugin to prevent others from seeing it in the code (however it would still be visible in the page source).

<script>$.salt = '123456';</script>
<script src="js/jquery.realperson.js"></script>

Alternately, you can supply the salt value as the value of a hidden field with an ID of 'salt'. The field is deleted after being saved by the plugin to prevent others from seeing it in the code (however it would still be visible in the page source).

<input type="hidden" id="salt" value="123456">

You can also use the $.salt value to set the selector for the hidden field.

<script>$.salt = '#mysalt';</script>
...
<input type="hidden" id="mysalt" value="123456">

Or get the value through an Ajax call.

<script>
$.ajax({url: 'salted.php', async: false, success: function(result) {
	$.salt = result;
}});
</script>
<script src="js/jquery.realperson.js"></script>