I'm asking for a suggestion more than for a real problem. I would like to use the more appropriate approach rather than limit to solve my problem.
I have a DIV
containing text, and a button
, that toggle "contenteditable
" attribute on it, in order to make it editable. Obviously, I could have more than one couple "button-div" in page.
<button class='toggle-edit'>Start Editing</button>
<div id='div-to-be-edited' contenteditable='false'>
...
</div>
I need to link button to its relative editable div, and I thought about rel attribute or custom aria-attribute like:
<button class='toggle-edit' rel='div-to-be-edited'>Start Editing</button>
or
<button class='toggle-edit' aria-edit-div='div-to-be-edited'>Start Editing</button>
My idea is to intercept via jQuery, rel
or aria-attribute
of clicked button, and than apply contenteditabile attribute to relative DIV
.
Problem is that these attributes seems to not be thought for this particular purpose by specific. Can you suggest me the most clean solution?
Thank you.