I’m trying to toggle a attr value (rel or href) on click.
$('#open').click(function () {
$(this).text($(this).text() == 'View Project' ? 'Close' : 'View Project');
$(this).attr('rel','#page');
$('#view').slideToggle(550);
return false;
});
I’ve got a text swap in there that’s change out the text for a#open when toggled open/toggle close.
But I need to swap the rel or href from #view to #page when toggled open but then back to #view on the toggle close. I’m needing the swap of these as it’s needed for using scrollTop.
Any help would be greatly appreciated!
Basically you’re wanting to do the same thing to your rel attribute that you’re doing to the text of the element.
and I assume you want to use the current rel for the slide toggle