Resolving "unexpected token ILLEGAL" message in an autocomplete form-field question?

sewolo London, ON, CanadaCommunity Member Qubie ✭
edited July 29 in Custom Code

Thank you in advance to anyone who can help!

I'm assisting on round 2 of a project and we're trying to re-use a bit of JS code written in 2019 by someone who is no longer working on the project.

The question type is form-field, and respondents can enter up to 20 responses. We'd like to ensure that when respondents start typing, an option from a list of 800+ options starts to auto-complete - we want to reduce the amount of data clean up to do later on.

Our code looks like:

var autocomplete_services = [
"Example Option", 
"Example Option 2", 

jQuery(# + this.questionId)


When I try to apply this as javascript to the question (with our actual options between the [ ] brackets), I get an "Invalid Javascript! You cannot save until you fix all errors: Unexpected token ILLEGAL" message!

As mentioned we're trying to re-use this bit of code that was previously written, and I'm not familiar enough with JavaScript to figure out what's going wrong on my own. I feel like there's something really obvious I'm missing.

Any help is greatly appreciated; I couldn't find any similar questions by searching. Thank you in advance!

Best Answer

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    Accepted Answer

    change # to "#"


  • sewolo
    sewolo London, ON, CanadaCommunity Member Qubie ✭

    Thank you so much, it worked!

Sign In to Comment

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!