Phoenix Blog Posts

Using Select2 with Phoenix LiveView

featured_image

LiveView doesn’t support JavaScript interop at the moment (but it’s a planned feature), so in this article we see how to come up with a workaround to make LiveView playing together with a JavaScript library like Select2.

We see how to take advantage of phx:update ​ events, which LiveView dispatches every time it updates the DOM. Then we see how to send events to the server using liveSocket.

5 Likes