Reputation: 951
Here is the jfiddle: http://jsfiddle.net/RHbzv/
What I am trying to do is that when the answer is displayed, 'See more' turns into 'See less' but I can't seem to get it right.
I have tried:
$('.see_more').on('click', function(){
if ($(this).text() == 'See more'){
$(this).text('See less')
} else {
$(this).text('See more')
}
$('.answer').slideToggle('slow')
})
Any ideas???
Upvotes: 0
Views: 219
Reputation: 3678
$('.see_more').on('click', function(){
if ($(this).html() == 'See more'){
$(this).html('See less')
} else {
$(this).html('See more')
}
$('.answer').slideToggle('slow')
})
see the demo here http://jsfiddle.net/Junkie/RHbzv/1/
Upvotes: 1