I'd like to push data to the data attribute of an element using jQuery. is that even possible?
the element looks like this:
<span id="el" data-id="[1]"></span>
and I'd like to get
<span id="el" data-id="[1, 2]"></span>
how can achieve that? I know I can set the data value with $('#el').data('id', [1, 2, 3, 4]); but as I get the ids from a PHP file (therefore I don't know the ids I'll get) so I guess I have to use something similar to push().