/    Sign up×
Community /Pin to ProfileBookmark

too much recursion

this code:

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

given me and error of “too much recursion”

how can i solve this?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KorOct 22.2010 — Is it so hard to make it clear from the beginning that you are using a JavaScript library/framework? Which one? Working with a library is not compulsory for a JavaScript coder. Working with [I]all[/I] (to be able to make the difference) is almost impossible.

So, if you want to improve your chances to get an answer, do specify, please, starting even with the title of the thread, [I]which library do you use[/I]. JQuery? Prototype? MooTools? Scriptaculous? Dojo? Other?
Copy linkTweet thisAlerts:
@AlphaBravoXOct 22.2010 — Does he even know he is using a Framework? But it pretty much looks like jQuery since it is also the most popular one.
Copy linkTweet thisAlerts:
@KorOct 22.2010 — Does he even know he is using a Framework?[/quote]
if he does not, that means he knows nothing about javascript, thus we are wasting our time

But it pretty much looks like jQuery since it is also the most popular one.[/QUOTE]

No one is obliged to know that. What if it is a part of a custom library written as in JQuery style, but with other functionality? The problem with custom methods is that you will never know what is behind them, as long as you can not see the core source.
Copy linkTweet thisAlerts:
@scifirocketauthorOct 22.2010 — it is jQuery. sorry for the confusion. i don't mean to waste your time here on this web development forum.

this code is constructed in this manner because elements with the "a.crosslink" class are generated after the DOM has loaded. In other words, the database script (in PHP) prints out results with the a.crosslink tag. Therefore, just adding the class to the result will not work.

To see what I am talking about, go to eataustineat.com/testfolder/ and type a 'D' in the search field. It will produce a list of results using ajax. Clicking one of those links will produce the recursion error.
×

Success!

Help @scifirocket spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...