in jquery if i use $("#my_button").data('my-value', { onClick: function () { my_obj_function(); } });
and in another function i do this
my-value.onClick.call()
it works.
but if i try to set the data attrib in html it not working.
i did this in html
<a href='#' data-my-value='{"onClick":"function () { my_obj_function(); }"}'>Click me</a>
while calling my-value.onClick.call()
i'm getting
uncaught typeerror : object function() has no method call
what am i doing wrong?