mardi 16 janvier 2018

What to use instead of HTML data attributes when you need to recall IDs later

So I was reading this article where it states,

External software should not interact with it [data attributes]. Marking up contact details or event details using custom data attributes would be wrong...

However, I have a list of 100 or so topics as such,

<li class="topic" data-topic-id="1" data-original-topic-name="Interaction Design">
    <input value="Interaction Design">
    <button class="edit-topic">Edit</button>
    <button class="delete-topic">Delete</button>
</li>

And in my JS I just set a button listener for edit-topic and delete-topic classes, and send the relevant AJAX request with parents data-topic-id as the payload ID. Is this alright even though the user could change the ID? If not, how could I bind/set an ID to a button without the user seeing the value?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DjdyCD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire