Q:

jQuery Replace Link Text with Show and Hide

I'm trying to change some 'Show More' link text to 'Show Less' once the associated content has been revealed, using jQuery.
I have created a jsfiddle to illustrate what I have done so far. I also need the content to close when I then click on the 'Show Less' link.
jQuery(function(){
    jQuery('.reveal_more').click(function(){
        jQuery('.box').hide();
        jQuery('#item-'+jQuery(this).attr('target')).show();
    });
});

I wondered if someone might be able to help me out? :)

A:

You can use .text(function) to set text of your anchor element and based on its text value you can show/hide target using .toggle( boolean)
Code
jQuery('.reveal_more').click(function(){
    jQuery('.box').hide();

    //Switch text              
    $(this).text(function(_, val){
        return val == "Show More" ? "Show Less" : "Show More"
    });

    //Toogle target element        
    jQuery('#item-'+jQuery(this).attr('target')).toggle($(this).text() == "Show Less");

});

DEMO

