EDIT:
The goal is to NOT have the screen move to the top of the page when clicking the link. I just want it to hide the short description and show the full one.
jQuery("#more_info a").live('click', function(event)
{
event.preventDefault();
jQuery('#food_desc').hide();
jQuery('#food_desc_full').show();
});
The above code works except for stopping the default event (going to the top of the page) from happening. Is it because of the live() event?
EDIT:
I even tried this:
if (data.body_summary)
{
jQuery("#food_desc").append('<p id="more_info"><a href="#">MORE »</a></p>');
jQuery("#more_info a").click(function(event)
{
event.preventDefault();
jQuery('#food_desc').hide();
jQuery('#food_desc_full').show();
return false;
});
}
Still goes to top of page...
I also tried this:
jQuery("body").delegate("#more_info a", "click", function(event)
{
event.stopPropagation();
event.preventDefault();
jQuery('#food_desc').hide();
jQuery('#food_desc_full').show();
return false;
});
It does the show/hide of long/short description but doesn't stop the page from going to top.