Setting the right input type on a form field makes mobile devices show the matching keyboard, such as a number pad for phone numbers. This makes forms faster to fill in. This script changes a field's input type to any valid HTML type without affecting the form's styling.
This is community code, not an official Unbounce feature. Unbounce Support can't troubleshoot custom code. Test it on a published page before relying on it, and work with a developer if you aren't comfortable editing HTML, JavaScript, and CSS.
Examples on Android
Add the script to your page
The script is hosted on GitHub as this gist. For a full list of input types, see W3Schools.
- Add your form and its fields.
- Copy the script from the gist and add it to the JavaScripts section.
- Update the
setTypecall with your own values. The first parameter is the field name and the second is the input type, for examplesetType("your_phone_number", "tel"); -
Add another
setTypecall for each additional field you want to change. - Save, republish, and test the page on a mobile device.