Hello!

There is such a construction in HTML:

<div>Автомобиль ВАЗ</div>

I need to assign this <div> additional parameters, for example: {title_URL: vaz, category: rus_marks} .

Then, I will send this data to the server using Ajax in JSON format.

Tell me, please, with the help of which technology is the assignment of <div> blocks of specific parameters realizable? I heard that you can use BEM, which seems to be owned by Yandex.

And what else is there, maybe it can be done somehow easier?

Thank!

1 answer 1

BEM - it has nothing to do with your question, and we do not own it, but promote it :)

You can write data to an element either by creating an attribute with it or by changing its property.

I think all the necessary information can be found here:

https://stackoverflow.com/questions/5874652/prop-vs-attr/5884994#5884994 https://learn.javascript.ru/attributes-and-custom-properties