Autocomplet in stache not working

Hi all,

I am a bit confused running easy-autocomplete within a can.view.callbacks setup.
I created a JS Bin with two input fields.
The first defined in the “regular” body environment, the second initialized via callbacks.attr.

The first one works, the second does not. Any idea what I am doing wrong?

Cheers,

Nada

Looks like the JSBin doesn’t have your code. Can you update the link?

Uups…
Link is updated now

Doesn’t anybody have at least a hint?

Hi @nada, sorry for not responding sooner!

When the callbacks function runs, the input is created but it’s not yet added to the DOM. For some cases, this is helpful because the element will already have any modifications made to it before it’s added to the DOM, but in this case the other library doesn’t work well in this scenario.

To work around it, you can just wrap the easyComplete call with a setTimeout, like in this JS Bin: https://bitovi-jsbin.jsbin.com/reragak/1/edit?html,js,output