Solved
Adding autocomplete JavaScript to my survey?
How can I incorporate autocomplete JavaScript into my survey? For example, like the documentation shown here (http://jqueryui.com/autocomplete/). I have a text entry question that asks "Where do you live?" I would like to have an autofill solution that when the user starts to type in "n" it will prompt answers such as New York, New Jersey, etc.
Best answer by AnthonyR
In your header, you will need to include jquery and jqueryui and run jquery.noconflict
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
Then in the question you are adding this to, you will add the following to the addOnReady function of the Javascript editor (Update the array of possible entries according to your needs):
var textOptions = [
"art","ant","all","alt","pun","pit"
];
jQuery('.InputText').autocomplete({source:textOptions})
I have attached a QSF of this working.
Leave a Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.