0

I have created an ActionCable channel using rails generate channel conversation speak, then added something like the below code at the end of conversation.coffe:

$ ->
  $("button").click (event) ->
    alert() 
App.conversation.speak("main", event.target.value)

This works as intended and creates a new comment, along with a button that will spawn new comments. The appended button does not fire the above code though. I am using a comment partial and it works only on refreshing the page.

Vantalk
  • 367
  • 2
  • 5
  • 21

1 Answers1

0

In the end I changed the code detection in my coffee to $(document).on 'click', '[data-attribute]', (event) ->

Vantalk
  • 367
  • 2
  • 5
  • 21