Dynamic values in toDOM

This post maybe of help: How I can attach attribute with dynamic value when new paragraph is inserted?