Redirect code not working

I have the ff.code:<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”<br /> “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> $(document).ready(function() $(‘.videos’).click(function() //window.demo.logSectionVisit( “Visited Videos Section” ); $(location).attr(‘href’,”google.com”); //alert(0); //window.location.href = “http://stackoverflow.com”; );}); New Session Videos …

via HTML Language Development » Search Results » ajax:

Redirect code not working

I have the ff.code:
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>





I wonder why when I click the videos button, it isn’t redirecting. any ideas?
Many thanks in advanced!
……………………………………..

Additionally to what Andrew suggests, if you need to have the anchor tag, either remove the href attribute from the anchor or add a preventDefault() to the click handler as:
$(‘.videos’).click(function(e)
// note that if you redirect to google.com only, it a relative redirect…
// so to go to the actual www.google.com site, use the full url
$(location).attr(‘href’,”http://www.google.com”);
e.preventDefault();
);
……………………………………..

Instead of

Videos

try

Videos

……………………………………..

Try to uncomment the line:
//window.location.href = “http://stackoverflow.com”;
and comment the line:
$(location).attr(‘href’,”google.com”);

For more info: Redirect code not working

HTML Language Development » Search Results » ajax

Redirect code not working

Share this post:

Related Posts

Leave a Comment