Too much recursion

this code:

$(document).ready(function() {    
	$('body').click(function(evt) {       
	 if(evt.target.nodeName === 'A' && $(evt.target).hasClass('cross-link')) {           
  		$('a[href=#2]').trigger('click');        }    });});

given me and error of “too much recursion”

how can i solve this?

so I need to create a conditional where if I am currently in a class “a.crosslink”, then i do nothing?

$(‘a[href=#2]’).trigger(‘click’);

If that anchor has the class cross-link, than yes, what you have there is an infinite loop. Not sure what your trying to do, so the only thing I can recommend is remove that line. Though, that will kill all functionality entirely, if any. You would need to add a third condition to drop out a[href=#2] that element so that the trigger() isn’t executed again.