$('.more').not(this).text('[ + ]');
set text of all button to [ + ]
expect the current button .
문제
Please see this fiddle http://jsfiddle.net/rabelais/gCm7w/
I have hidden text that is revealed by clicking on the [ + ] sign.
The [ + ] changes to [ - ] when the hidden text is revealed, and changes back to [ + ] when it is hidden again using this code:
(function($) {
var allPanels = $('.accordion > dd').hide();
$('.accordion > dt > a').click(function() {
allPanels.slideUp();
if($(this).parent().next().is(':hidden'))
{
$(this).parent().next().slideDown();
}
$(this).text( $(this).text() == '[ + ]' ? "[ - ]" : "[ + ]");
return false;
});
})(jQuery);
However if one clicks the other hidden text to reveal it without closing the previous text, the previous text is hidden but the [ - ] does not change back to [ + ], how do I edit my code to make this happen?
해결책
$('.more').not(this).text('[ + ]');
set text of all button to [ + ]
expect the current button .