I am trying to add data-id attribute in the table column. So, I can add like these two ways.
$(this).data('id',10);
And,
$(this).attr('data-id',10);
What is the exact difference of these two methods. And which one is better to use in jQuery.
I am trying to add data-id attribute in the table column. So, I can add like these two ways.
$(this).data('id',10);
And,
$(this).attr('data-id',10);
What is the exact difference of these two methods. And which one is better to use in jQuery.