Jquery slider issues

First, I think I need to show you what I’m trying to accomplish:

  1. Go to: http://eataustineat.com/testfolder/index.php
  2. Type in a ‘d’ into the search box
  3. Select the first result, Dog Almighty
  4. Click the “Something!” tab in the row of tabs above the results listings.

You should notice information corresponding to the item you selected. The list of results and the displaying of the associated information is queryed using SQL and ajax controls the displaying of the information in the div “results2” (under the “Something!” tab).

I need for the coda-slider over to the something tab automatically when i link is selected, but this is not happening because of an asyncronus javascript issue (that’s the best way I can summerize it.)

How do I fix this problem, or am I going about this entirly wrong?


$(document).ready(function() {
    $('body').click(function(evt) {
        if(evt.target.nodeName === 'A' && $(evt.target).hasClass('cross-link')) {
            alert('clicked');
        }
    });
});

Anything?

the list of results is populated through the use of SQL commands managed by a PHP file (searchtest.php), and dynamically displayed using ajax so I guess the answer to you’re question is no.

the text input is constructed like this:

<input onkeyup="getName(this.value)" type="text" />

here is the code for generating the list of results:

	function getName(value) {
		$.post("searchtest.php",{partialName:value},function(data) { $("#results").html(data);

		})
		}

in turn, searchtest.php spits out results:

echo "<a class=\\"cross-link\\" href=\\"javascript:ajaxpage('result.php?id=$ID', 'results2');\\">".$name."</a><div id=\\"contentarea\\"></div>";

Are these happening after the DOM has fully loaded?

so the code you posted previously displayed the alert message, so I went ahead and changed swapped

this line:

alert('clicked');

for this line:

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

and it will move the slider over, but I get this error is firebug:

too much recursion
[Break on this error] (function(){var Q=/((?:\\((?:\\([^()]+\\)...,typeof J==="string"?J:J+"px")}})})();

the above error points me to the jquery.js file (which i have attached as jquery.txt). how do I stop this apparent infinite recursiveness!

nope. no elert message unfortunantly. :confused:

Could try the first part alone to see if the click is even getting picked up.


$('body').click(function(evt) {
    if(evt.target.nodeName === 'A' && $(evt.target).hasClass('cross-link')) {
        alert('clicked');
    }
});

did i just use this wrong? i’m not sure. i understand what the code you provided is trying to do, but I just can’t get it to work.

so if i understand this code correctly, it says that when a link is clicked, if it is of type ‘cross-link’, then it appends goes to index.php#2. what is being passed in as ‘evt’? just placing in this code doesn’t work.

here is the jquery code for a.cross-link in the coda-slider:

// Same-page cross-linking
jQuery("a.cross-link").click(function(){
    jQuery(this).parents().find(".stripNav ul li a:eq(" + (parseInt(jQuery(this).attr("href").slice(1)) - 1) + ")").trigger('click');
			});	

This might work, didn’t test test it. Depends on how the slider functions.


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