Fork me on GitHub
Inputosaurus Text

illustration by @theskywatcher

Inputosaurus Text is an <input> that allows for multiple delimited values, parse hooks, autocomplete, keyboard shortcuts, etc.

Examples

Default

- The instantiated input's value is set to a list of values delimited with a comma (outputDelimiter).
- As values are input, if a comma or semi-colon (inputDelimiter) is detected, the value is automatically parsed.

toggle hidden input/markup
$('#widget1').inputosaurus({
    width : '350px'
});

Autocomplete

toggle hidden input/markup
$('#widget2').inputosaurus({
    width : '350px',
    autoCompleteSource : ['alabama', 'illinois', 'kansas', 'kentucky', 'new york'],
    activateFinalResult : true
});

Parse Hook

- A good use case for the parse hook is input validation.
- For this example, enter two strings separated with a space to trigger the parse hook (which will surround the strings with double quotes).

toggle hidden input/markup
$('#widget3').inputosaurus({
    width : '350px',
    outputDelimiter : ' OR ',
    parseHook : function(valArr){
        return $.map(valArr, function(val){
            return /\s/.test(val) ? '"' + val + '"' : val;
        });
    }
});

Options