Question: I'm trying to make a simple messenger for my school project

I need to store id number of each chat message inside himself (which is a div tag) and I want to access this value from JavaScript with id or name of div.

sorry for my bad English

Answer: 
You can store arbitrary data in custom attributes.

```
<div id="id1" any="value">

document.getElementById("id1").getAttribute("any");

```
```
divID = 'the id of your div';
content = 'the content you want in that div';
div = document.getElementById(divID);
div.innerHTML(content);

```

Documentation:

[.getElementByID](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById)

[.innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)