I am a complete beggar and was hoping to get some help in my first script.
Basically, I want one link to be clicked to slide down and change the link text, when it clicks again, the process will change.
here is my code:
$(function() {
if ($('#link1:contains("link text")')) {
$('#link1').click(function() {
$('#div1').slideDown(2000);
$('#link1').text('hide div 1');
});
}
else {
$('#link1').click(function() {
$('#div1').slideUp(2000);
$('#link1').text('link text');
});
}
});
Any help would be appreciated, thanks guys.
source
share