Answer the question
In order to leave comments, you need to log in
Why isn't a value assigned to the data-autorNAME attribute?
I'm trying to adapt this gallery for myself vodkabears.github.io/galereya I use
it on the page: https://pl-galerie.ru/galerie/
I want to add a new attribute to the picture: data-autorNAME. The value is assigned using PHP. When viewing the source code of the page, you can see that the attribute value is not empty.
The checks showed that in the code section
and in the section
in autorNAME an empty string is assigned. What can be wrong?
The previous data-detail and data-autorURL attributes are handled correctly autorNAME:a.autorNAME||""
autorNAME:b.getAttribute("autorNAME")||""
Answer the question
In order to leave comments, you need to log in
Firstly, you need to use lower case
Secondly, you need to get it from the dataset
<div id="b" data-author-name="ivan">
…
</div>
var name = b.dataset.authorName;
alert(name);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question