target
The attribute to target
target: 'data-populus-c'
It's often bothering, if not difficult to set up a small demo using a text or a search input. Depending on what you want to achieve, you have to set up the submit buttons, the clear buttons, the update of the value of the input, accessibility, etc.
That's why POPULUS was born, it was made to help you setting up complete text inputs to build demos and experiments faster!
<input type="text">
<input type="text" data-populus>
var populus = new Populus();
populus.init({
target: 'data-populus',
features: {
wrapper: true,
placeholder: 'Another POPULUS instance',
autocomplete: true,
autocorrect: true,
autocapitalize: true,
spellcheck: true,
required: true,
autofocus: false,
updateValue: true,
a11y: {
label: 'Search more',
outline: ['2px', 'dotted', 'lime', '-5px']
}
},
The attribute to target
target: 'data-populus-c'
If true, it will wrap the Populus input with a <div class="populus--wrapper">>div>
.
features.wrapper: true
The placeholder of the input
features.placeholder: 'Another POPULUS instance',
Enable/disable autocompletion
features.autocomplete: true
Enable/Disable autocorrection
features.autocorrect: true
Enable/disable autocapitalize.
afeatures.utocapitalize: true
Enable/disable spell-checking
features.spellcheck: true
If true, the input will be required.
features.required: true
If true, the input will be auto-focused on page load.
features.autofocus: true
If true, the value of the input will be updated as you type.
features.updateValue: true
Add the aria-label
, name
and title
attributes to the input
a11y.label: 'search input'
Add outline for accessibility
a11y.outline: ['2px', 'solid', 'blue', '-2px']
The text/html of the search button
buttons.search.label: 'Search!',
The JS executed when clicking on the search button
buttons.search.onClick: 'this.parentNode.childNodes[0].focus()'
The text/html of the cancel button
buttons.cancel.label: 'cancel',
The JS executed when clicking on the cancel button
buttons.cancel.onClick: 'this.parentNode.childNodes[0].value=""'