<img> Attributes

I have java script code that implements a slide show view. It uses a series of img tags as a table to control its actions. I probably used some kind of code that I found somewhere as a basis. In any case, the img tags contain the data-img attribute, which I cannot find in any img tag definition. Now I find that I need to add more data to the img tags. So my questions are:

1) Is data-img really a real attribute or something adhoc?

2) Can I invent even more attributes?

3) What is the danger of using such attributes?

+3
source share
3 answers

1) HTML 5; (, , - , ) HTML 4

2) , Javascript, , , DOM , - ,

3) .

: - Yay nay?

+2
  • .
  • , .
  • # 2, , , DOM , , .
0

HTML5.

If you need to add and receive this data only using javascript for the client side, without contacting the server side, you can implement a save and extract mechanism similar to that used by Mootools.

It does not pollute the DOM, nor does it save javascript objects.

0
source

Source: https://habr.com/ru/post/1775973/


All Articles