Reputation: 101
I cant get my jQuery to work.
I want the text "Show more" when the div is closed, then "Show less" when it is open.
This text works when it opens, but when it closes it wont change..
$('.more_content').click(function(){
$('p.show').text($('p.show').is(':visible') ? 'Show less' : 'Show more');
$('#extra_content').slideToggle('fast')
});
Upvotes: 0
Views: 70
Reputation: 101
$('.more_content').click(function(){
$('#extra_content').is(':visible') ? $('p.show').text('Läs mer om oss') : $('p.show').text('Läs mindre om oss') ;
$('#extra_content').slideToggle('fast')
enter code here});
Upvotes: 0
Reputation: 80629
The statement
$('p.show').is(':visible')
should be:
$('#extra_content').is(':visible')
Upvotes: 2