I have the following code:
<div
class="continueReading"
data-skip="0"
data-categories="22,243"
data-is="single"
data-s="cd1f2f7a7d"
data-list="latestNews-sidebar-1"
>
<a href="javascript:void();" class="latestNewsWidgetMoreLink">get more</a>
<a href="javascript:void();" class="latestNewsWidgetMoreButton">»</a>
</div>
$('.latestNewsWidgetMoreLink, .latestNewsWidgetMoreButton').click(
function()
{
total_items = 10;
$(this).parent('div').attr('data-skip', total_items);
}
);
but seems don't work. Can somebody to help me? Is there any error in this code?
Note: I have also try the following code with no luck:
total_items = 10;
$(this).parent('div').data('skip', total_items);
thisis in the context of the code.<head>tag, somewhere in the<body>tag, just before the</body>tag? It may be executing before the elements exist, in which case you'd need a DOM ready handler.