I'm searching for this sometime. Found this old article and this. But not working for me.
My Problem is : I cannot set incremented data-id
to HTML Element via jQuery. I'm able to alert the same, But I failed to set in HTML. There is no change in the element if I inspect.
jQuery
$(document).ready(function() {
$("#search").click(function(){
var num = $(this).data('id');
num++;
$("span").text(num);
$(this).data('id', num);
});
});
I tried this also
$(this).data('id') === num;
Here is a jsFiddle Demo
I'm using v1.9.1
and no error in console. Its great if anyone can find the issue.