views:

28

answers:

2

I have some jquery code that uses the live method of triggering events:

$(document).ready(function() {
$('.cross-link').live(function() {
$('a[href=#2').click(); }); });

Where 'cross-link' elements can be generated after the DOM has loaded.

Firebug reports that "F is undefined". It references the last line in my jquery.js file that begins with (function(){var Q=/((?:((?:([^()]+)|[^()]+)+)|[(?:[[^[]]*]|['"][^'"]+['"]|[^[]'"]+)... ect. I read that it may be the case that my Jquery library is out of date. So I downloaded the latest version, but it produced other errors.

What should I be looking for to fix this?

A: 
$('a[href=#2').click(); }); });

Can you check the above sytanx , there is some error in your code that why jquery is throwing error

gov
A: 

Live needs even handler. Modify your code like this:

$(document).ready(function() {
  $('.cross-link').live('click', function() {
    $('a[href=#2').click();
  });
});
Sarfraz
that takes care of this problem, but now I have the "too much recursion" problem again. I've asked this question elsewhere: http://stackoverflow.com/questions/4011916/too-much-recursion-error-in-jquery/4011989#4011989
scifirocket
@sci: It is because of this line `$('a[href=#2').click();` You need to do it in some other way or find an alternative to it.
Sarfraz