I have an anchor tag that when is clicked displays more items, after display those items another anchor appears and collapse those items again. I have this script that search a string inside an attribute called evitd in the anchor tag, the string value is ('expand_collapse') when it finds the value triggers an alert, then displays more items and the collapse anchor appears but the script is not working the second time even tho the anchor has the attribute evtid with the value 'expand_collapse'. Any suggestion will be kindly appreciated
$(document).ready(function(){
$('.ms-cal-nav').each(function () {
var $this = $(this);
$this.on("click", function () {
if ($(this).attr('evtid').indexOf('expand_collapse') > -1) {
alert("hello");
}
});
});
});
<div class="ms-acal-ctrlitem" _expand="expand"><a href="javascript:void(0);" class="ms-cal-nav" evtid="expand_collapse"><img border="0" width="9" height="7">7 more items</a></div>