coffeescript - How to detect events for button appended with ActionCable? -


i have created actioncable channel using rails generate channel conversation speak, added below code @ end of conversation.coffe:

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

this works intended , creates new comment, along button spawn new comments. appended button not fire above code though. using comment partial , works on refreshing page.

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


Comments