Suppose you have this:
<a href="#" data-mydata="{'key':[value1, value2, value3]}">LINK</a>
And somewhere in your javascript when you are reading/checking that data you want to push more values to 'key.'
This obviously does not work:
var mykey = $('a').data('mydata').key;
$('a').data('mydata', mykey.push('value4'));
This doesn't work either:
var mykey = $('a').data('mydata').key;
$('a').data('mydata.key', mykey.push('value4'));
I haven't found this to work either:
var mykey = $('a').data('mydata').key;
$('a').data('mydata', '{"key":'+mykey.push('value4')+'}');
I must be missing something here.