how to pass data to javascript in div.content_tag

No, the first line is ruby and the convention is snakecase so it’s ok you use underscores, the second line is html and the attributes syntax is hyphen, when you access that data attribute with javascript it will be dataset.conversationWithId as camelcase. You should write using the convention of the language you are using, then each language takes care of converting it.

No, the first line is ruby and the convention is snakecase so it’s ok you use underscores, the second line is html and the attributes syntax is hyphen, when you access that data attribute with javascript it will be dataset.conversationWithId as camelcase. You should write using the convention of the language you are using, then each language takes care of converting it.

<%= content_tag :div, id: “message_holder”, data: {conversation_with_id: @conversation_with.id} do %>

translates to this html from page source:

<div id="message_holder" data-conversation-with-id="3">

Camel case beginning with lower case?

In my case, since I used received(data) { do you mean dataset or data ?

How are you able to reply after I’ve deleted my original post It’s a pattern in here, whenever I delete a post I get a repsonse to a post that I already deleted It lends the impression that I’ve been deleting them after

data attributes (data-something on an html tag) are accessed using the “dataset” property of javascript’s HTMLElement element https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset , that “received(data)” sounds like a callback from a promise or ajax call to me, that’s a totally different thing.

Camel case has two variants: first letter can be lower or upper case (camel case with capital first letter is also known as PascalCase)

I respond via emails, I guess you delete the post on the google groups page but the email is already sent.

Can you please show me the first and second lines that refers to, I see you gave me the answer but I forgot what was the question

Also when javascript is included on the html.erb page in containers then I can use <%= @some_data_here %> but when javascript is in a separate file I can’t use that method unless I rename the file to js.erb ?