Question

The problem

For my project I use Zepto, but I would like to use the select2 plugin for my select input elements. According to this issuethis pull request it should be possibel, yet I couldn't manage to do it. I usually get the error "jQuery not defined"

What I have

  • I generate the form dynamicaly, but only call the plugin, once I have the whole form.
  • I use the latest select2 and Zepto version.
  • I also have the data component included into Zepto.
  • EDIT: Of course I have the select2 CSS included too. (if it wasn't obvious)

What I tried

  • updating my Zepto and select2 (as the issue was 3 months old and my project was older)
  • aliasing Zepto as jQuery. If I do that, I see some DOM elements of the select and it also hides my original select element, but it still not working.

Anyone else encountered this problem before or know how to solve it? It would be greatly appreciated. Thanks.

Was it helpful?

Solution

Soo. I posted the question to GitHub as an issue, and the creator of the plugin Igor Vaynberg said that I misunderstood the linked issues, as they didn't mean select2 woud support Zepto, they only meant it will be easier to support, if it will be supported some time in the future.

For Igor's answer see this comment. I might try and implement this myself, if my time permits it, and if I do I will edit this answer also.

OTHER TIPS

If you want to use a selection that actually does support Zepto.js, you might be interested to try out Selectivity: https://arendjr.github.io/selectivity/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top