Is it possible with the HTML data-
attributes to hold a reference to another DOM element? For example, I could do this with jQuery:
var domel1 = document.getElementById("#mydiv")
var domel2 = document.getElementById("#mydiv2")
$(domEl1).attr('data-domel', domel2)
Then later on, with jQuery I would do:
var domel1 = document.getElementById("#mydiv")
var domel2 = $(domel2).data('domel')
$(domel2).html("blahblahblah")
This might seem like a trivial example because I could just reference domel2
with the same id
like I did at first, but there are cases where this could be useful for representing relationships between <div>
s.
.data()
method to store any jQuery object, but it won't be written back to the DOM.