It is necessary to prohibit the transition on the link at the first click and allow only after the second. Wrote the code:
var clickCount = 0; $(".categoriesPage .categoryBox .textBox").attr("data-count", "0"); $(".categoriesPage .categoryBox .textBox").on("click", function(){ $(this).each(function() { clickCount ++; if (clickCount == 1) { $(this).attr("dataCount", clickCount); return false; } else { return true; } });
Does not work, what could be the error? The second option also does not work
$(".categoriesPage .categoryBox .textBox").attr("data-count", "0"); $(".categoriesPage .categoryBox .textBox").on("click", function(){ $(this).each(function() { var clickCount = $(this).attr("data-count"); clickCount ++; if (clickCount == 1) { $(this).attr("dataCount", clickCount); return false; } else { return true; } }); });