#community-help

Troubleshooting Searchbox Widget in Vue3

TLDR Trey needed help with setting up the searchbox widget in Vue3. Jason suggested using vue-instantsearch instead of instantsearch.js.

Powered by Struct AI
3
13mo
Solved
Join the chat
Aug 23, 2022 (13 months ago)
Trey
Photo of md5-749919409638d08a91ad3605486496e7
Trey
03:00 PM
Hi everyone. im trying to get an autocomplete implementation setup in vue3, but am running into some issues with the searchbox widget. I cant seem to set the container no matter what I try and I can't find a solution anywhere. If I set the widget like this:
search.addWidgets([
  searchBox({
    container: '#searchbox'
  }),

I get Uncaught (in promise) Error: Container must be string or HTMLElement. Unable to find #searchbox

and if i try to pass in the query selector like this:
search.addWidgets([
  searchBox({
    container: document.querySelector('#searchbox')
  }),

I get Uncaught (in promise) Error: The container option is required.

If anyone has seen this type of error or can point me in the right direction, i would really appreciate it
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:22 PM
Trey If you’re using vue, you want to use vue-instantsearch instead of instantsearch.js
04:23
Jason
04:23 PM
The syntax in your code snippets is for instantsearch.js